Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4254822
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:08:08+00:00 2026-05-21T05:08:08+00:00

I am using JQuery validate and calling a javascript method on the onclick event.

  • 0

I am using JQuery validate and calling a javascript method on the onclick event. But even when the validation fails, it still calls this method. How do I check within the method if the validation failed, so that I can prevent this code from running?

<button id="btnSave" name="btnSave" runat="server" type="submit" onclick="addUser()" style="font-size:11px;font-family:Verdana;font-weight:bold;" >Save</button>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T05:08:09+00:00Added an answer on May 21, 2026 at 5:08 am

    If this is the plugin you’re using, you could use the onValid and onInvalid callback functions of the plugin and hook in the desired behaviour there.

    For example, remove the JS from your HTML:

    <button id="btnSave" name="btnSave" runat="server" type="submit" style="font-size:11px;font-family:Verdana;font-weight:bold;" >Save</button>
    

    and change the call to the plugin to something like

    $("#btnSave").validate({onValid:addUser});
    

    If you’re using some other validation plugin, check the documentation – any good plugin will provide similar hooks that you can use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using additional method for checking capcha validation using jquery.validate $.validator.addMethod(ajax_validation, function(value) {
Using the jQuery Validation plugin and AJAX, how can I validate the contents of
I'm currently using jQuery.validate as a plugin for validation... my problem comes into play
I'm using jQuery Validate Plugin: http://bassistance.de/jquery-plugins/jquery-plugin-validation/ Simple demo: <input type=text name=email class=required email />
I'm using jQuery validate on a form I am building and it is working
Using jQuery, how do you bind a click event to a table cell (below,
Note: This question refers to a very old version of jQuery.validate() (version 1.5). This
I am using the jQuery validation plugin on my form. I set the basic
I'm using the jQuery validation plugin. On most of my input type... tags I
I'm using jQuery validate plugin, and when I met the following script, i recognize,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.