1

I have hopefully a very straight forward question. I have an H3 tag with some text in it. I need to have that text show up as the text value inputted in a text field, How can I make the H3 text the same as the text field with Jquery?

Here is the ID of the H3, detectiveFill_1 here is the ID of the input loc_else_text

Thanks in advanced!

4

1 回答 1

4

这将更新h3输入焦点丢失的元素

$('#loc_else_text').change(function(){
    $('#detectiveFill_1').text(this.value);
});

这将在按下键时立即更新

$('#loc_else_text').keyup(function(){
    $('#detectiveFill_1').text(this.value);
})
于 2013-07-23T22:13:58.070 回答