I want to find all form elements, with a specific class, and check if they have been altered or not. The if-statement does its job, but I have no idea to correct the find thingy. Is this in the right direction or have I got it all wrong?
$("input").find(".formWithMyClass").load(function () {
if (this.value !== this.defaultValue) {
$(this).addClass("inactiveForm");
}
});
Cheers!
You could write a custom selector…
Then you should be able to do
$('input:defaultValue')to get allinputelements of whom theirvalueproperty is set todefaultValue.However, if you want to find all input type elements, you may want to extend that custom selector.
I can’t seem to find a way to get
selectelement’s original values (not without setting them up first and foremost). TheirdefaultValueproperty isundefinedandselectedIndexcould be the last chosen value.