I'm writing a bit of jquery to access a dro开发者_C百科pdown, but .net automatically changes the id by adding ctl00$...
Is there any way to stop it from changing it?
Thanks
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.
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.
精彩评论