Reputation: 4024
I'm writing a bit of jquery to access a dropdown, but .net automatically changes the id by adding ctl00$...
Is there any way to stop it from changing it?
Thanks
Upvotes: 2
Views: 73
Reputation: 78848
The ID is changed because your page could have multiple controls containing child items with duplicate IDs, or the master page might as well. I find it best to only use class selectors when dealing with jQuery and ASP.NET WebForms.
Upvotes: 1
Reputation: 1038780
If you are running on ASP.NET 4.0 you could use static or predictable ids. If not you could append a CSS class to your control and use CSS class selector in jQuery instead of id selector.
Upvotes: 1