javascript - With (or similar) statement in JQuery -


Very simple question: I want to optimize the following jQuery code with maximum readability, optimum performance and minimal disturbance (nuisance = New declaration) variables etc.):

  $ ("Addthis_toolbox"). Attachment ('& lt; one class = "addthis_button_delicious"> gt; & lt; / a & gt;'); $ ("Addthis_toolbox"). Attachment ('& lt; one class = "addthis_button_facebook"> gt; & lt; / a & gt;'); $ ("Addthis_toolbox") .andand ('& lt; class = "addthis_button_google"> gt; & lt; / a & gt;'); $ ("Addthis_toolbox"). Attachment ('& lt; one class = "addthis_button_reddit"> gt; & lt; / a & gt;'); . . . $ ("Addthis_toolbox"). Attachment ('& lt; one class = "addthis_button_yetanotherservice"> gt; & lt; / a & gt;');  

The statement with javascript is:

 with  ($ ("Addthis_toolbox")) {app ('& lt; class = "addthis_button_delicious"> gt; & lt; / a & gt;'); ...}  

It is possible that you can make a statement with some confusing issues using the movable radius by .

You get the same thing:

  $ ("Addthis_toolbox"). Attachment ('& lt; one class = "addthis_button_delicious"> ;) .append (...) .append (...);  

Comments