Assuming the second input field is triggered by a user instigated event, then you could just trigger that event.
$('input#change').click(function() { $('input#source').attr('value', 'This is the value changed by a button'); $('something').trigger('blur',fn); }); -----Original Message----- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jay Sent: Tuesday, June 16, 2009 3:46 PM To: jQuery (English) Subject: [jQuery] How to simulate a human-triggered event? Hi, I'm trying to change the value of an input field (target) which depends on another input (source). It works well when I manually change the source value. But if I changed the source value with another button, the target value remains the same. Here's the code... $(document).ready(function() { $('input#change').click(function() { $('input#source').attr('value', 'This is the value changed by a button'); }); $('input#source').change(function() { $('input#target').attr('value', $('input#source').attr('value')); }); }); <p>Source: <input type="text" name="target" id="source" size="60" value="" /> <input type="button" id="change" value="change source value" /></p> <p>Target: <input type="text" name="target" id="target" size="60" value="This is the original value, type something in source to change" /></p> So how could the target input detect if there's a change within the source input without manually changing it's value? Thanks