Friday, August 14, 2009

How to get the innerHTML from Label and update it.

While I was working on a particular web application, I had to have the account number displayed when there was a chagne is dropdown menu. Now, all that worked well with a bit of a javascript.

But, the real issue was after the button was pressed , the page it dispalyed still retained the selected drop down item but the account no. on the label was gone and was being displayed as blank.

Hence, after a bit of the research I found out the easiest way to solve this issue was via implementing another javascript on ButtonClick.

Eg.


OR//



Please note, the mistake the people gerenally make is to put your script before the textbox.

When page load , javascript try to execute the code by do not know yet the textbox control and the div.

To be sure that a javascript is executed when all your page is loaded (or DOM built) add defer="defer" on javascript tag

No comments:

Post a Comment