This jQuery doesnt appear to be working as I would expect it to:
$('#topic li a').filter(function () {
if ($(this).text() > 410) {
$(this).parent('li').addClass('wrap');
}
});
The jQuery should work out if the text within an <a href=>....</a> is over 410 chars, if it is it should add the class .wrap to the parent li.
Anyone have any ideas what im doing wrong?
When you do
$(this).text() > 410it tries to convert the text to an integer to compare, it most likely is converting the long string to a number like 0. Use.lengthto get the length of the string returned