I have created a custom text box with property "key"(ASP.NET C#).I want to get the value of this property "key" using java script.How can I do this?
+2
A:
Not sure what you are asking.
if you have a textbox rendered like so:
<input type="text" id="foo" key="somekey" text="Hello" />
You could get the value of "key" in JS like so:
document.getElementById('foo').getAttribute('key')
Raj Kaimal
2010-03-26 05:23:55
I have created a server side custom control <cus:TextBox id="foo" Key="somekey" runat="server" Text="Hello"/>I want to get the value of key.In view source Html generated is <input type="text" id="foo" text="Hello" />No Html is generated for custom property Key.
Dee
2010-03-26 06:10:17
If key is not generated in the html, then you have a problem with your custom control.
Raj Kaimal
2010-03-26 13:45:28
A:
If you are using jquery than for this will help you.
$("#tb1").attr("key")
for this textbox
<input type="text" id="tb1" key="mykey" text="" />
Sharique
2010-03-26 06:00:28