Sunday, 25 January 2015

Jquery selector by patern match




1)    If you want to select elements with an id which starts with a given string (for example txtTitle):
$("[id^='txtTitle']")

2)    If you want to select elements with an id which ends with a given string:
$("[id$='txtTitle']")

3)    If you want to select elements which id contains a given string:
$("[id*='txtTitle']")

4)    If you want to select elements which id is not a given string:
$("[id!='myValue']")

5)    If you want to select elements which id contains a given word, delimited by spaces:
$("[id~='myValue']")

6)    If you want to select elements which id is equal to a given string or starting with that string followed by a hyphen:
$("[id|='myValue']")







No comments:

Post a Comment