I am learning jQuery. The code snippet as below. I don't understand the syntax of the last statement.
Why there's no
.
?what does the
[]
mean?BTW, what's special with the
$
?/* Code provided for context, irrelevant to the actual question. $('#executeButton').click(function(){ $('body').addClass('done'); $('.done #controls :radio').attr('disabled',true); var sources$ = $('#sourcePane input:checked~img'); if ($('[name=clone]:checked').val()=='yes') sources$ = sources$.clone(); var targets$ = $('#targetPane input:checkbox:checked').parents('.target'); var operation = $('[name=operations]:checked').val();*/ targets$[operation](sources$); //<=== HERE /*});*/
And some more context:
<div> <label>Operation:</label><br/> <input type="radio" name="operations" value="append" checked="checked"/> append <input type="radio" name="operations" value="prepend"/> prepend <input type="radio" name="operations" value="before"/> before <input type="radio" name="operations" value="after"/> after </div>