dexter
dexter

Reputation: 7203

jQuery - find html element with server generated id

I have this element I need to find in the DOM with the id of:

ctl00_Spwebpartmanager1_g_0dff8583_314d_412f_8be7_ad019dd61cf3_ctl00__socialSecurityNumber

How do I get a hold of it?

Upvotes: 3

Views: 88

Answers (3)

Elias Zamaria
Elias Zamaria

Reputation: 101083

document.getElementById("ctl00_Spwebpartmanager1_g_0dff8583_314d_412f_8be7_ad019dd61cf3_ctl00__socialSecurityNumber")

If you want to do things with it using jQuery, you can do it like this:

$("#ctl00_Spwebpartmanager1_g_0dff8583_314d_412f_8be7_ad019dd61cf3_ctl00__socialSecurityNumber")

Upvotes: 1

banzsh
banzsh

Reputation: 550

Can you output the token to a javascript var and then use it for identifier?

Upvotes: 1

Mathias Becher
Mathias Becher

Reputation: 703

You can try something on the lines of

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

The $= means that the attribute ends with the specified string.

Upvotes: 3

Related Questions