admin管理员组文章数量:1278976
I am trying to change a textbox value.
am trying following javascript but in both the alerts am getting image only. ie.
$('#FileName').val = "testimage.jpg";
is not changing the text box field value.
<x:input type="textbox" id="FileName"
width="210px" value=""/>
if ($("#FileName").val() == "image") {
alert($("#FileName").val())
$('#FileName').val = "testimage.jpg";
alert($("#FileName").val())
}
I am trying to change a textbox value.
am trying following javascript but in both the alerts am getting image only. ie.
$('#FileName').val = "testimage.jpg";
is not changing the text box field value.
<x:input type="textbox" id="FileName"
width="210px" value=""/>
if ($("#FileName").val() == "image") {
alert($("#FileName").val())
$('#FileName').val = "testimage.jpg";
alert($("#FileName").val())
}
Share
Improve this question
asked Mar 20, 2013 at 6:50
RomiRomi
4,93128 gold badges83 silver badges114 bronze badges
3 Answers
Reset to default 7you have used jquery
try $('#FileName').val("testimage.jpg");
and using javascript document.getElementById('')
document.getElementById('FileName').value = "testimage.jpg";
you should try this
if ($("#FileName").val() == "image") {
alert($("#FileName").val())
$('#FileName').val("testimage.jpg");
alert($("#FileName").val())
}
val is a method, not a property, so:
$('#FileName').val("testimage.jpg";)
本文标签: How to change textbox value using javascriptStack Overflow
版权声明:本文标题:How to change textbox value using javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741234676a2362772.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论