RIRedinPA Posted January 28, 2011 Share Posted January 28, 2011 The return is a string, right? So I should be able to do a str.IndexOf("something") on it, right? var userlinks = $(".userlinks").html(); //var indexnum = userlinks.IndexOf("Filter Records"); console.log(userlinks); if (userlinks.IndexOf("Filter Records") == -1) { ... I keep getting: userlinks.IndexOf is not a function Link to comment https://forums.phpfreaks.com/topic/225962-jquery-html-question/ Share on other sites More sharing options...
Adam Posted January 28, 2011 Share Posted January 28, 2011 That's because "IndexOf" isn't a function, "indexOf" is though. JS is case-sensitive. Link to comment https://forums.phpfreaks.com/topic/225962-jquery-html-question/#findComment-1166606 Share on other sites More sharing options...
.josh Posted January 28, 2011 Share Posted January 28, 2011 also for good measure you can throw .toString() into the mix to ensure it is a string: Link to comment https://forums.phpfreaks.com/topic/225962-jquery-html-question/#findComment-1166660 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.