I have a number of textfields and I need to select the values of those textfields whose values are not equal to their title
attribute.
Problem: With my attempt, the jQuery code below simply selects the value of the first matched textfield. How do I get all matched textfields' values?
jQuery Code
var inputs = $(".input").filter(function() {
return $(this).val() != $(this).attr('title');
}).val();
console.log(inputs);
Here is simpler solution:
var input = [];
jQuery('input[type=text]').each(function(){
if(jQuery(this).val() != jQuery(this).attr('title') ) {
input.push(jQuery(this).val());
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With