How do I access a DIV from javascript, if ASP.NET mangles its ID? -


I have a web page that has a "div" element on the page, to reference the div Javascript is: document.getElementById ('divId') .

Now, the document.getElementById ('divId') return is taped, unless another developer changed the page again to use the ASP Master page. It appears that when you use the master page, ASP.net prepares some characters in the names of elements of the content, how can I know when the page is loading, then what is the identity of the divis?

Update Allow me to give a specific example to clarify this question: ID divNotice in my page. After using my page master page, I think that when I print the source on the page which is the Divi ID ctl00_ContentPlaceHolder1_divNotice My question is, how should I know that when If this is done with the framework, what will be the div id?

I think this is what you are looking for.

  document.getElementById ('<% = divNotice.ClientID% & gt;')  

To get the ID of your element such as html Used on the page .clientID

Hope this help.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -