为什么我的元素值没有改变?我使用了错误的功能吗? [英] Why is my element value not getting changed? Am I using the wrong function?
问题描述
我有一个asp.net mvc应用程序,我正在尝试动态地为我的文本框分配值,但它似乎无法正常工作(我现在只在IE上测试)。这就是我现在所拥有的..
I have an asp.net mvc application and i am trying to assign value to my textbox dynamically, but it seems to be not working (I am only testing on IE right now). This is what I have right now..
document.getElementsByName('Tue')。Value = tue;
(顺便说一下tue是一个变量)
document.getElementsByName('Tue').Value = tue;
(by the way tue is a variable)
我也尝试过这种变化,但它也没有用。
I have also tried this variation but it didnt work either.
document.getElementsById('Tue')。Value = tue;
(顺便说一下tue是一个变量)
document.getElementsById('Tue').Value = tue;
(by the way tue is a variable)
有人可以告诉我这里出错了吗?
Can someone where please tell me where I am going wrong with this?
推荐答案
这是 document.getElementById ,而不是document.getElementsByID
It's document.getElementById, not document.getElementsByID
我是假设您的标记中某处有< input id =Tue...>
。
I'm assuming you have <input id="Tue" ...>
somewhere in your markup.
这篇关于为什么我的元素值没有改变?我使用了错误的功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!