I know it's easy to do using <button> or <input type="submit" but how would you keep this button disabled unless both input fields are filled?
Code:<input id="one" type="text"> <input id="two" type="text"> <a href="#" class="button">OK</a>
I know it's easy to do using <button> or <input type="submit" but how would you keep this button disabled unless both input fields are filled?
Code:<input id="one" type="text"> <input id="two" type="text"> <a href="#" class="button">OK</a>
Disable and href? Maybe you could preventDefault / return false; or remove the href attribute with removeAttribute('href') ?
Or how about hiding the link with style.display='none'; and when the input is filled, show it with style.display='block';
Focus on Function Web Design
Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps
qwikad.com (10-16-2015)
Thank you. I got some help over on stackoverflow. Similar to what you suggested.
And then you just do the button as <a class="button">OK</a>Code:$('#one, #two').blur(function() { if($('#one').val() !== "" && $('#two').val() !== "") { $('.button').removeAttr('href'); } else { $('.button').attr('href','#'); } });
Bookmarks