<script>
$(document).ready(function() {
var k = $('.tren li').filter(':not(:first):not(:last)');
alert(k[0]);
});
</script>
Live: http://jsfiddle.net/D9NTr/
It returns a message like [OBJECT HTMLLI ELEMENT]
. How can I retrieve the value of the object?
$(k[0]).text();
You need to use the text() method like:
alert(k[0].text());
I'll knock up a quick jsfiddle to demonstrate.
Not applicable to your example. But if you need the html, then k[0].html()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.