Discussion:
Find nodes
san82
2010-02-05 14:14:44 UTC
Permalink
Hi All,

I have the below HTML assigned to a variable in JS.

HTML:
#ChevronSPAN4 << #ChevronSPAN4id= >>

Please let me know using jQuery how can I search the variable for SPAN
elements with class="cheveron".

Thanks,
Sandeep
--
View this message in context: http://old.nabble.com/Find-nodes-tp27468324s27240p27468324.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Nathan Klatt
2010-02-05 14:44:20 UTC
Permalink
Post by san82
I have the below HTML assigned to a variable in JS.
Please let me know using jQuery how can I search the variable for SPAN
elements with class="cheveron".
I'm guessing your variable got munged, eh? Do you mean you have a
string of HTML? If so, you could DOMify it then search in that.

var tempDiv = document.createElement('div');
tempDiv.innerHTML = (your variable);
var cheverons = $(tempDiv).find("span.cheveron");

Nathan
san82
2010-02-05 14:52:46 UTC
Permalink
Post by Nathan Klatt
Post by san82
I have the below HTML assigned to a variable in JS.
Please let me know using jQuery how can I search the variable for SPAN
elements with class="cheveron".
I'm guessing your variable got munged, eh? Do you mean you have a
string of HTML? If so, you could DOMify it then search in that.
var tempDiv = document.createElement('div');
tempDiv.innerHTML = (your variable);
var cheverons = $(tempDiv).find("span.cheveron");
Nathan
Yes, this is what I needed...Thanks
--
View this message in context: http://old.nabble.com/Find-nodes-tp27468324s27240p27468911.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.
Continue reading on narkive:
Loading...