I want to be able to hide list items that have less than 3 characters, how do I do this? What is wrong with my code below?
I am a JavaScript/jQuery newbie.
jQuery().ready(function () {
if (jQuery('ol li').length < 3) {
jQuery(this).hide();
};
});
Your code is saying
What you want to use is filter
EDIT – Based on your comment in my post: If it is a span tag that could have other data around it:
Fiddle running the span example