Tuesday 15 April 2014

html - Hot to get svg inside a span using jQuery's find() -


I am having difficulty in selecting a svg element (actually written as img and later jquery Has been converted to SVG to use).

The code is:

HTML:

  & lt; Div class = "tab-content" & gt; & Lt; Div id = "personas" class = "active" & gt; & Lt; Span id = "boton_auto" & gt; & Lt; Img class = "svg" src = "img / auto.svg" /> & Lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

and jQuery

  $ ("Tab-content div span"). ("Svg") Search AddClass ("activo");  

What can be the problem? thank you in advanced!

You may have the first or complete line before svg

: $ ("Tab-content .svg") AddClass ("activo"); Edit Edit: I saw the code that replaces it with a SVG. It comes in asynchronous form. Are you running before your search line? Line $ img.replaceWith ($ svg); Try adding line directly after


No comments:

Post a Comment