Batu
Batu

Reputation: 421

jQuery Xpath selector to select an element which id contains 'sometext'

I have a listbox element in aspx page which id is attributesList.

I want to select this element to track its change event, but i cant directly select its id because asp.net changes its id on runtime.

its id, attributesList changes into ctl00_adminPlaceHolder_attributesList.

so what i want to do is to use a "contains" xpath expression to select the element.

Upvotes: 0

Views: 1582

Answers (1)

James Kolpack
James Kolpack

Reputation: 9382

You'll want to instead use the "End with" attribute selector like so:

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

Upvotes: 3

Related Questions