You may want to do it in the blur
of first textbox,
$('#dpd1').blur(function () {
$("#dpd2").prop('disabled', !$.trim($('#dpd1').val()).length);
});
Demo
prop takes a boolean. And when you set your textbox to disabled initially you can no longer click on it. hence use blur
to perform the action once you focus out of the first textbox.Use $.trim()
to remove the whitespaces from ends of the textbox value