Answers for "jquery input multiple value"

0

jquery get multiple input values by name

<input name="titles[]">
<input name="titles[]">
<button>submit</button>

// click handler
function onClick(event) {
  var titles = $('input[name^=titles]').map(function(idx, elem) {
    return $(elem).val();
  }).get();

  console.log(titles);
  event.preventDefault();
}

// attach button click listener on dom ready
$(function() {
  $('button').click(onClick);
});
Posted by: Guest on May-19-2021
0

how to check condition multiple input value in jquery

$('#Rusername, #Remail, #Rpassword, #Rpassword2').each(function() {
  if ($(this).val() == '') {
    $(this).parent().effect('shake', {times: 3}, 50).find('.verdiv').addClass('error');
  }
});
Posted by: Guest on July-02-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language