I'm hoping this is fairl simple but having done a lot of googling and experimenting with selectors, find(), content(), text(), etc I'm not quite getting this right. Any help would be appreciated.
I have some custom markup in the web page.
<div id="myGrid">
<url>www.google.com</url>
<columns>
<column>ID</column>
<column>Position</column>
<column>FirstName</column>
<column>LastName</column>
</columns>
</div>
I need to select the text of <url>
into a variable.
I also need to get a collection of <columns>
's into a variable (array/collection).
The tag name will be the identifier, i.e. I can't use an ID or CLASS to find these elements.
Seems like it should be do-able but my attempts so far are hit and miss... any help is much appreciated.
Thanks!
var $t = {}
var i = 0;
$('#myGrid').find('column').each(function(){
$t[i] = $(this).text();
i++;
});
alert($('#myGrid url').text());
alert($t.toSource());