开发者

dynamically convert string to HTMLControl in javascript

开发者 https://www.devze.com 2023-03-08 00:33 出处:网络
I am having one id of textbox in form of string & I want to set some value from js. How could I set it

I am having one id of textbox in form of string & I want to set some value from js. How could I set it

document.formid.getElementByTag("input").getelementId("strTextId").value = dynamicVal 

Other cases its HTMLInputObject ref. But here I am having string id only

Please guide me. I wanted to do it in javascript on开发者_C百科ly


If I understand your question correctly (questionable), you want to set the text property of a textbox. If that's correct, here's how you do it:

document.getElementById("strTextId").value = dynamicVal;
0

精彩评论

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