0

http://tinyurl.com/8z8rup5

Please take a look at my development so far. I am trying to, in jQuery, disable the tabs on the top of this form, as well as the Next Step links (these are anchors, not input buttons - at least until the submit button) until the fields are filled out on that specific tab. The user may return to previous tabs after they have entered data in the tabs before them. They would not necessarily need to be -correct-, but just have user input, I think.

I'm not entirely sure how to go about it since I am trying to disable anchor links (and fade their opacity) rather than input buttons.

Any help would be fantastic! Thank you.

  • 2
    Please post the relevant code here. – j08691 Sep 12 '12 at 15:07
  • This is what I've been doing - really not the best way I'm sure... but I haven't put in any input checking yet as I wasn't sure how to :) $('#stepone').click(function() { $(this).addClass('active'); $('#steptwo').removeClass('active'); $('#stepthree').removeClass('active'); $('#stepfour').removeClass('active'); $('#stepfive').removeClass('active'); $('.contact-bottom-step-one').fadeIn(); $('.contact-bottom-step-two').hide(); $('.contact-bottom-step-three').hide(); $('.contact-bottom-step-four').hide(); $('.contact-bottom-step-five').hide(); }); – Brian Lewis Sep 12 '12 at 15:52

2 Answers2

0

Try taking a look at this post: How to enable or disable an anchor using jQuery?

Basically you would want to prevent the default functionality of the anchors until certain criteria is met:

$('a.something').click(function(e) {
  if(!valid) 
    e.preventDefault();
});
Community
  • 1
  • 1
Chase
  • 29,019
  • 1
  • 49
  • 48
0

You can use preventDefault() to prevent the default actions from occuring. So for your navigation links you could disable them using:

$(".desktoponly a").click(function (e){
   e.preventDefault();
});

Obviously you could do the same thing for any other anchor tags in your site. On the button clicks you can check to see if the form is complete and only transition if the form is complete.

See this fiddle:

http://jsfiddle.net/johnkoer/j6X88/4/

John Koerner
  • 37,428
  • 8
  • 84
  • 134