开发者

How to get Custom Property from ASP.NET Textbox using javascript?

开发者 https://www.devze.com 2022-12-24 13:27 出处:网络
I have created a cu开发者_JS百科stom 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?Not sure what you are asking.

I have created a cu开发者_JS百科stom 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?


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')


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

精彩评论

暂无评论...
验证码 换一张
取 消