In a huge ajax application I have many forms with individual ids, but the fieldnames may heavily reoccur. Due to differing validation necessities I inevitably need a combined jquery selector consisting of the form name and input class.
To identify validation fields I use classnames like "isadatefield", which are not defined in my css.
What finds too much is:
$(".isadatefield").datepicker({dateFormat: 'dd.mm.yy'});}
because it finds all input fields with class "isadatefield" in all forms where I only want those in "myform".
Example what should be found:
<form id='myform' ...>
<input id='startdate' name='startdate' class='isadatefield blue'/>
Example what NOT should be found:
<form id='otherform' ...>
<input id='startdate' name='startdate' class='blue'/>
What is the selector for a form named "myform" that addresses all input fields in only this form with class "isadatefield" and avoids addressing other fields named startdate in forms with other ids?
Aucun commentaire:
Enregistrer un commentaire