I know you can use :contains to get elements who's innerHTML contains a certain string, but how can I get the elements whose innerHTML starts with a string?
Using a filter function you can filter based on any criteria that you'd like:
var spans = $("span").filter(function(idx) { return this.innerHTML.indexOf(myString) == 0; });
2.1m questions
2.1m answers
60 comments
57.0k users