When something is typed in the url field and it is cleared again. Both input fields should be set to disable false.
The code is live here: http://jsfiddle.net/buyC9/117/
My HTML:
<h1>Upload image:</h1>
<input type="file" name="blog[opload]" id="blog_opload" class="imagec">
<input type="url" size="50" name="blog[url]" id="blog_url" class="imagec">
<div id="preview">
</div>
My JQUERY:
$('input').change(function() {
$('.imagec').prop('disabled', true);
$(this).prop('disabled', false);
alert( $(this).text() );
if ( $(this).attr('type') == 'url') {
$('#preview').show().html('<img src=' + '"' + $(this).val() + '"' + ' />');
}
});
if( !$('.imagec').trim(this.value).length ) {
alert('TOM');
}