Using JQuery, I can do the following to get the text within my LI
$("#listingTabs li").eq(2).text();
How do I set the text? Because the following doesn't work
$("#listingTabs li").eq(2).text() = 'insert new text';
Using JQuery, I can do the following to get the text within my LI
$("#listingTabs li").eq(2).text();
How do I set the text? Because the following doesn't work
$("#listingTabs li").eq(2).text() = 'insert new text';
$("#listingTabs li").eq(2).text("insert new text");
You can also set the innerHTML of the li using
$("#listingTabs li").eq(2).html("<b>insert new text</b>");
The text()
function works as both a getter and a setter. Try this:
$("#listingTabs li").eq(2).text('insert new text');
If you give it a parameter, it acts as a setter for that property. If you don't, it acts as a getter.