javascript - How to use jquery in a string? -
using jquery, how can search through string of html code, example:
<script type="text/javascript"> alert($('#t','<span id="t">d</span>').html()); </script>
i expect d
in alert, undefined...
does know how this?
actually use ajax request html string of page. if try paste string in tag, current page gets messed up. wanted search through given string.
the context parameter context within jquery search. i.e. @ child elements of context not @ context itself. works:
alert($('#t','<span><span id="t">d</span></span>').html());
i'm not quite sure you're trying there though. have element, no need search it. example never applied real world problem.
Comments
Post a Comment