javascript - what does it mean to wrap an in place function with a jquery selector? -


i confused happening here:

$("a[class='delete']").click(function(e) {    $( function() {      $( "#dialog" ).dialog({});    } ); }); 

i see @ first link element selected , when click event on link happens function executed. function says select (i guess because of $ sign) whatever output of function is. next function selects element dialog class , runs dialog function on it.

practically happens html element has class dialog comes on screen dialog box. question why function selects dialog box element inside of selector?

i know when delete selector wrapping function() there syntax error (which don't quite understand) why not use code:

$("a[class='delete']").click(function(e) {       $( "#dialog" ).dialog({        });   }); 

passing function $() same thing as

$(document).ready(function() { /* */ }); 

in case, looks code written confused person. there's no reason set code "ready" handler in response "click" event, @ least in general. should equivalent:

$("a[class='delete']").click(function(e) {    $( "#dialog" ).dialog({}); }); 

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -