0

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?

1
  • 2
    don't post your question as the title. Commented Mar 26, 2010 at 5:13

2 Answers 2

2

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')
Sign up to request clarification or add additional context in comments.

2 Comments

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.
If key is not generated in the html, then you have a problem with your custom control.
0

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="" />

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.