Append text to form input element value on focusout()
I'd like to append a 'saved' text to a value in an input form element when
it goes out of focus. I've tried the following, but it doesn't seem to
work.
My element:
<div class="info small">
<span class="element">
<label for="email">Email</label><br />
<input type="text" id="email" value="" />
</span>
</div>
My jQuery:
$('div.info').on('keyup', 'input', function(event){
$id = $(this).parent().parent().attr('id');
$id = parseInt($id);
$field = $(this).attr('id');
$text = $(this).val();
updateField($id, $field, $text);
});
$('div.info').on('focusout', 'input', function(event){
$('input').append(' saved.');
});
No comments:
Post a Comment