if else in submit jquery

I'm trying to put a condition in a JQuery submit button.  I'm not sure how to do it.

 $("#submit").click (function get(){
      if (counter>0){
      medLength=0;
      }      


/*      it works fine without this but I need this condition
if (medLength == 0 && counter == 0){
             $('.errorStop').css().show;
      }
      else{*/
 
/*AJAX*/

$.ajax({
                    url: "postnew1.php",
                    type : "POST",
                    data: { type: medType, time: medLength, length: counter },

                        }).success(function (response){
                        location.href = "meditate.php";                                            
                        }).error(function (e){
                        // console.log("error", e)
                        });

                  });
designaireAsked:
Who is Participating?
 
leakim971Connect With a Mentor PluritechnicianCommented:
replace :
 $("#submit").click (function get(){
by :
 $("#mySubmit").click (function(evt) { // change its name and id too
   evt.preventDefault();
0
 
leakim971PluritechnicianCommented:
replace yiur submit button by a normal button

<input type="button" name="mySubmit" id="mySubmit" value="Submit"  />

$("#mySubmit").click (function() {
0
 
designaireAuthor Commented:
I can't replace the submit button it has a graphic on it.
0
 
Ray PaseurCommented:
Uhh, what about using CSS to style the input control?
0
 
designaireAuthor Commented:
Thanks so much!!!
0
All Courses

From novice to tech pro — start learning today.