I have a `input` text field which is filled with the url of an image using a jQuery function.
After changing the url, I need the new image displayed. But when I use the `.change` jQuery event, the image only gets updated if the field is changed by the keyboard.
I have the function that updates the image but how do I trigger it even when the field is changed via another function rather than the keyboard?
How do I use the "onChange" event of the `input` to run the jQuery function?
This is the function which sets the value of the input box with a url
function selectURL(url) {
if (url == '') return false;
field = window.top.opener.browserWin.document.forms[0].elements[window.top.opener.browserField];
field.value = url;
if (field.onchange != null) field.onchange();
}
The function which updates the image:
$(document).ready(function() {
$('#image').change(function() {
var src = $(this).val();
$('#imagePreview').html(src ? '<img src="' + src + '">' : '');
});
});
Probably if using the `onchange` element of the input box for executing the jQuery function will be working properly and I was asking for this!