javascript - Check if text field is empty before executing jQuery -


this might easy question, find confusing.

how run myfunc() if textfield_1 not empty?

excicute .on('click', '#openbutton', myfunc) if ($('#textfield_1').val()!="") ?

check inside handler:

.on('click', '#openbutton', function() {     if( !$('#textfield_1').val().trim().length ) myfunc(); //thanks @mike suggestion on trim , length, see comments }) 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -