I am stuck here. I need to be able to do a keypress on one field, focus on another textarea to trigger a keypress event, then focus back on the original field. Here is my semi-working fiddle
Here is the code:
$('.editor').keyup(function () {
//console.log($('#purpose').val());
$('#purpose').trigger('keyup');
});
$('#purpose').bind('keyup propertychange', function (e) {
//console.log(e);
$("#purpose").focus();
$("#purpose").val($('#purpose-editor').val());
console.log($("#purpose").val());
$('#purpose-editior').trigger('input');
});
$('#purpose-editor').bind('input propertychange', function (i) {
console.log(i);
$('#purpose-editor').focus();
});
I can type in on the top field and focus on the second field, however I cannot focus back on the original field. Thanks in advance!
Instead of focusing each time, you could just try this:
$('#purpose-editor').keyup(function() {
$('#purpose').val($('#purpose-editor').val());
});
Fiddle: http://jsfiddle.net/3E9mG/2/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.