Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/423.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 提交时如何在文本字段中显示范围值_Javascript_Jquery_Html - Fatal编程技术网

Javascript 提交时如何在文本字段中显示范围值

Javascript 提交时如何在文本字段中显示范围值,javascript,jquery,html,Javascript,Jquery,Html,如何使用javascript在文本字段中显示范围值 我的密码是 4 我想在提交时用java脚本显示4 var spanText = document.getElementById('count').innerHTML; document.getElementById('txtArear').value=spanText ; 在提交HTML时尝试此代码 <span id="count">4</span> <input type="text" id="result"

如何使用javascript在文本字段中显示范围值

我的密码是

4


我想在提交时用java脚本显示4

var spanText = document.getElementById('count').innerHTML;

document.getElementById('txtArear').value=spanText ;
在提交HTML时尝试此代码

<span id="count">4</span>
<input type="text" id="result"/>
<input type="button" id="submit"/>
使用Javascript

<span id="count">4</span>
<input type="text" id='place_value'/>
<input type="button" value='Submit' onclick='place_val()' />
<script type="text/javascript">
function place_val()
{
    var span_value = document.getElementById("count").innerHTML;
    document.getElementById("place_value").value = span_value;
}
</script>
4
Javascript

<span id="count">4</span>
<input type="text" id='place_value'/>
<input type="button" value='Submit' onclick='place_val()' />
<script type="text/javascript">
function place_val()
{
    var span_value = document.getElementById("count").innerHTML;
    document.getElementById("place_value").value = span_value;
}
</script>

功能位置_val()
{
var span_value=document.getElementById(“count”).innerHTML;
document.getElementById(“place\u value”).value=span\u值;
}
=========================

使用JQuery

<span id="count">4</span>
<input type="text" id='place_value'/>
<input type="button" value='Submit' id='submit' />
4
JQuery

<script type="text/javascript">
$("#submit").on("click", function(){
    var span_value = $("#count").html();
    $("#place_value").val(span_value);
});
</script>

$(“#提交”)。在(“单击”,函数(){
var span_value=$(“#计数”).html();
$(“#放置#u值”).val(跨度#u值);
});

你试过什么吗?但我认为你应该专注于我的答案。我不是说你的答案错了或者你的英语不好,我只是纠正了你的错误。所以在这里请冷静,当我选中存储在span中的it count 1复选框时,现在我想在文本框中显示span,请帮助查看这里