The thing starts from my previous question: Using jQuery is it possible to compare two attributes in a selector? I mean something like:
$('element[atribute1!=attribute2]')
or, in a practical example:
$('input[name!=id]')
In my case, I would need it to get how many input fields haven't been changed in an html form used to edit something, I was trying to get this code to work:
if($('input[DefaultValue!=input.value]').lenght==0){...}
What about it? It should return the number of changed fields (if i get 0 i will stop form submission, show an alert message and go back without updating)
Thank for your help.
No. If you look through jQuery's documentation, you'll see there's no such selector.
Also
defaultValue
is a property, not an attribute.You can do this:
You can use the jQuery filter() function, like this:
Then, you can test
different.length > 0
.Here's a full working example: http://jsfiddle.net/us47d/