javascript - This pretty little jQuery code seems to not work.. anyone know why? -


If I run it, it does not make any errors and in the firebug it actually selects the right elements in the DOM.

If I separate it and do something like this:

  $ ('img [hspace]'). CSS ('margin left', ($ ('img [ASTR (' HSPAS '/ 2) +' PX ')  

This works.

It is completely monster.

  $ ('img [hspace]'). Each (function (L) {var pixels = pars in ($ (L) .attr ('hspace' ); If (isNaN (pixel)) pixels of & lt; 1) pixels = 0; rest pixels = pixels / 2; $ (L) .css ('marginLeft', pixels + 'pixels') .css ('  Update   

/ P>

  `div class = 'grid_7' & gt; & lt; p & gt; & lt; p & gt; this is mine & lt; / p & gt; & lt; P & gt; img align = "left" alt = "dude its me" border = "10" height = "168" hspace = "30" src = "http://s3.amazonaws.com/hq- Photo / root / system /photos/6187/resized_orig/photo.jpg "vspace =" 10 "width =" 130 "/> gt; & lt; / p & gt; & lt; p & gt; this is as good as It gets & lt; / p & gt; & lt; p & gt; this isasd & lt; / p & gt; & lt; p & gt; sdfasdfasdfasdfasd & lt; / P & gt; & Lt; P & gt; Asdfasdfasdf & lt; / P & gt; & Lt; P & gt; Asdfa & lt; / P & gt; & Lt; P & gt; Sdfasdfasdf & lt; / P & gt; & Lt; P & gt; & Amp; Nbsp; & Lt; / P & gt; & Lt; P & gt; & Amp; Nbsp; & Lt; / P & gt; & Lt; P & gt; & Amp; Nbsp; & Lt; / P & gt; & Lt; P & gt; & Amp; Nbsp; & Lt; / P & gt; & Lt; P & gt; & Amp; Nbsp; & Lt; / P & gt; & Lt; P & gt; & Lt; Img align = "right" alt = "also me" range = "50" height = "168" hspace = "50" src = "http://s3.amazonaws.com/hq-photo/root/system/photo /6187/resized_orig/photo.jpg "vspace =" 50 "width =" 130 "/> gt; & Lt; / P & gt; & Lt; / P & gt; & Lt; / Div & gt;    

Each function you might have of $ (this) Rather than $ (el) .


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -