I do not want to show the file browser if the input does not contain any text.
This is my code...
var haveText = false;
$('#input_box').bind('change',function(){
if($(this).val()) {
haveText = true;
} else {
haveText = false;
}
});
$('a.plupload_add').click(function(e) {
uploader.trigger("DisableBrowse", true);
if(haveText) {
$(this).unbind('click');
uploader.trigger("Refresh");
uploader.trigger("DisableBrowse", true);
uploader.trigger("DisableBrowse", false);
} else {
alert("no test");
}
e.stopPropagation();
});
What should I change to do what I require?
Maybe you could just toggle the browse button visibility when your textbox changes value :
$('#input_box').bind('change',function(){
if($(this).val()!=='') {
$("a.plupload_add").show();
} else {
$("a.plupload_add").hide();
}
});