Use the "context" parameter of the selector

$("input", formjQueryObject)




On Feb 5, 10:42 am, bob <xoxeo...@gmail.com> wrote:
> Hi,
> What is the best way to access a field in a form when I already have
> an jQuery object referencing form.
>
> function myFunction(formName, fieldName){
>
>         var formjQueryObject = jQuery('#'+formName);
>
>     var formField = jQuery("#"+formName+" [name='" + fieldName +
> "']");
>     or can I somehow utilize "formjQueryObject" and make field
> selection faster?
>
> }
>
> <form name="myForm_1" id="myForm_1" >
>         <input type="text" name="login" />
>
> <form name="myForm_2" id="myForm_2" >
>         <input type="text" name="login" />
>
> myFunction("myForm1", "login");

Reply via email to