Mich
Mich

Reputation: 137

JQuery selector: id ends with dynamic value

I am wondering if i there is a way i can use this selector with dynamic value in jQuery.

$("[id$=someValue]")

so i can select all the elements that ends with this dynamic value in my HTML page

Upvotes: 0

Views: 2196

Answers (2)

Cláudio Barreira
Cláudio Barreira

Reputation: 459

$('[id*="someValue"]')

if the id contains part of the expression inside the quotation marks.

Upvotes: 1

martincarlin87
martincarlin87

Reputation: 11042

$("[id$='someValue']");

Should work, note the value being enclosed in quotation marks.

Upvotes: 0

Related Questions