Just upgraded from jQuery 1.3.2 to 1.8.2 and found that several functions that worked in 1.3.2 no longer work. Most of these I’ve fixed, but stuck on this one:
I need to search based on the first few characters within a table cell (a “starts-with” search), but this code no longer works in recent versions of jQuery:
var matchingElements = $("#tblSelect1>tbody>tr>td:first-child[innerText^='" + text + "']");
I suspect it has something to do with the fact that several things that used to work like attributes are now properties instead – innerText is a property (I think) and so maybe it is not compatible with the attribute starts-with selector notation: [attr^='value']
I do not want to use :contains because I only want the elements whose innerText starts with the search text
Thoughts? Thanks!
You can use
filtermethod.innerTextis a non-standard property and doesn’t works on Firefox, for supporting all the main browsers you should check both the properties, or use jQuerytextmethod which is cross-browser.