Adding text to label using javascript

While accessing label value from JavaScript, we try like this

document.getElementById('<%= this.lblClientType.ClientID %>').value

But this wont work as it doesn't contain a property called value.

Resolution :


document.getElementById('<%= this.lblClientType.ClientID %>').innerHTML

Reason:


Because when we see the page source, label is been converted to span, where as textbox is converted to input control

asp:label to span control
asp:textbox to input of type "text"


Please provide the comments, if any...

Comments

Popular posts from this blog

Maximize child MDI form without ControlBox

Get Text Height & Width