keyup strange problem!!!!!
HTML CODE:
<div id="header"></div>
<form>
<input id="target" type="text" />
<input id="target2" type="text" />
</form>
JQUERY CODE(Test 1):
$(function(){
$('#target').keyup(function() {
$('#target2').attr("value",function(){
return $('#target').val() ;});
});
});
JQUERY CODE(Test 2):
$(function(){
$('#target').keyup(function() {
$('#header').html("<h1>"+function(){
return $('#target').val() ;}+"</h1>");
});
});
The Test 1 is working fine as expected but the test2 function is not executing and the header becomes "function(){return $('#target').val() ;}"...Whts the reason?
and is there any other way to do it fast?The text in target2 is a 1/2 letter behind target1.
Please help