Find an item using jQuery
I have HTML that looks like this.
<li class="t-item t-first"> <div class="t-top"> <span class="t-icon t-plus"></span> <span class="t-in">Offshore</span> </div> <input type="hidden" value="41393" name="itemValue" class="t-input"> </li> HTML is one element from a tree created by Telerik. The real data here is that "Offshore" has the identifier "41393".
From the Telerik code, I get a span element with the t-in class, but I cannot get an ID value from it. How can I use jQuery to find the value of a hidden input type?
+4
3 answers
how about this:
var $in = $(".t-in"); var text = $in.text(); //offshore var val = $in.parent(".t-item").find("input.t-input").val() //41393 this sorta works if you have only one t-in element, otherwise you will have to replace the first line in my code with the way you select the element yourself.
You need to provide more information, but this is the best I could do with what you gave
+5