Monday 15 February 2010

javascript - Is using THIS more efficent than using the selector? -


I have a simple form so users send their vote.
There I need to know what kind of radio button the user selects
The version I got to solve it was the version.

  value = $ ('input [name = vote]: checked', '#frmSurvey'). Val ();  

This work is fine. Even when I can not understand that work, because in selector documents there are only 2 examples with comma-separated items. And do not match my example where each element is inside the quote and then a comma

.class, .class ---> $ ("., Introduction, .demo") of the class All elements "Introduction" or "Demo"
el1, el2, el3 ---> $ ("h1, div, p") all & lt; H1>, & lt; Div> and & lt; P> element

Both are looking like a and instead of finding or looking like a selector, then find B in A.

can tell me what type of selector is that I would like to see in the documentation

Now I was thinking that if I adapted < I use the code> this element

  $ ('# frmSurvey'), then I'm not faster than the inside of the function for  #frmSurvey  Can be /) .jaxfarm (function () {value = $ ('input [name = vote]: checked', '#frmSurvey'). Val (); console.log ('working method' + value); Value = $ (this) .find ('input [name = vote]: check'). Val (); c Onsole.log ('test path' + value);  

but I

how do I fix another version?

And The second edition will be better than the first version because my instinct is suggestive or am I worried too much?

< P> Your first example shows the operating to a selector, while the one shown by you shows a selector.

Partially it

Value = $ ('Input [name = vote]: checked', '#frmSarvey'). Val ();

is basically the same as

value = $ ('# frmSurvey'). ('Input [name = vote]: checked'). Val ();

However, the reference to "this" inside your function is unclear because it depends on how the AJAXForm plug-ins are coded it is your initial selector Is not the result of. After a short play with the plugin, it will appear that is AJAXForm in the context of jQuery's AJAX request object.


No comments:

Post a Comment