开发者

Get input, and make it appear in html or another input field with jQuery

开发者 https://www.devze.com 2023-02-13 10:52 出处:网络
How can i make the input of an input textfield appear like output (this may be in another input field or just in html), when a button is clicked?

How can i make the input of an input textfield appear like output (this may be in another input field or just in html), when a button is clicked? Thanks in advance开发者_开发技巧!


Put in another textbox:

$('#outputTextBox').val($('#inputTextBox').val());

Append html to a div:

$('#outputDiv').append($('#inputTextBox').val());


<input type='text' name='myinput' id='myinput' />
<input type='submit' onclick='return handleSubmit();' />
<div id='myoutput'></div>

Then in js:

function handleSubmit()
{
    $('#myoutput').append($('#myinput').val())
    return false;
}
0

精彩评论

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