I have this question. I have a input type text and a button. Like this html:
<form id="browser-form">
<div class="filebrowser">
<input type="text" id="browser-filepath">
</div>
<div class="upload submit">
<a href="#" id="browser-submit" class="button">Uploaden</a>
</div>
</form>
But the question is. When the input type is empty. Je can not click on the button. When the input type is fil. Than you can click on the button. How can i fix that?
Thanks!
Assuming I’ve understood your question correctly, I think you want to prevent the link from doing anything unless the
inputhas a value. If that’s correct, then you can do this:preventDefaultis a method of the event object which, as the name suggests, prevents the default action of an event (in this case, following the link).Here’s a working example of the above.