I have the following list:
<ul id = "qualquer">
<li id = "listitem1" class = "middle_item">
</li>
<li id = "listitem2">
</li>
<li id = "listitem3">
</li>
</ul>
In my problem, class = "middle_item"
can be in any li
, but at this point it happens to be in the first li
.
I created the following javascript, to try to catch the id
of the li
that has the class = "middle_item"
var i = $("#qualquer .middle_item").attr('id').text();
alert(i);
but the following error appears to me:
Uncaught TypeError: $ (...). attr (...) text is not a function
Any suggestions?