I am trying to get all elements with an id starting with some value. Below is my jQuery code. I am trying to use a JavaScript variable when searching for items. But it does
try:
$("td[id^=" + value + "]")
Here you go:
$('td[id^="' + value +'"]')
so if the value is for instance 'foo', then the selector will be 'td[id^="foo"]'.
'foo'
'td[id^="foo"]'
Note that the quotes are mandatory: [id^="...."].
[id^="...."]
Source: http://api.jquery.com/attribute-starts-with-selector/