2014-05-08 45 views

回答

0

嘗試像這樣在提交..

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

document.getElementById('txtArear').value=spanText ; 
0
function SubmitForm(){ 
    var spanVal = $('span#count').text(); 
    $('textarea').val(spanVal); 
} 

嘗試在此代碼提交

0

HTML

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

JQUERY

$('#submit').on('click', function(){ 
$('#result').val($('#count').html()); 

}); 

FIDDLE DEMO

+0

其不FIDDEL其FIDDLE,無論如何,我已經更正 –

+0

謝謝@RakeshShetty –

+0

但我想你應該專注於我的答案。不是英語 –

0

用JavaScript

<span id="count">4</span> 
<input type="text" id='place_value'/> 
<input type="button" value='Submit' onclick='place_val()' /> 

的Javascript

<script type="text/javascript"> 
function place_val() 
{ 
    var span_value = document.getElementById("count").innerHTML; 
    document.getElementById("place_value").value = span_value; 
} 
</script> 

=========================

與jQuery

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

JQuery的

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