#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    208
    Rep Power
    0

    Exclamation How to wrap a button click to initiate function


    I ok with jQquery, I have been trying for hours on how to wrap a button click function to this.

    There is a onclick function on button called 'SendTransferAction', but still need to wrap it in the specific button only called button-2.

    Code:
               function SendTransferAction(){
                     jQuery("#response").validate({
                        expression: "if (VAL) return true; else return false;",
                        message: "Please enter correct Capthcha Code"
                     });	
               }
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    101
    Rep Power
    27
    Code:
    <button id="button-2">Button 2</button>
    <script type="text/javascript"><!--
    $("#button-2").click(function() { SendTransferAction(); });
    //-->
    </script>
    Last edited by mod_speling; July 3rd, 2013 at 11:01 AM. Reason: missed closing [code]
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2004
    Posts
    208
    Rep Power
    0
    Tried that methodology a few ways, it does not work.

    It like ignores the button click..
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    101
    Rep Power
    27
    Then you have something else in your page that's interfering. This method of assigning a click to a <button> (or <input> or whatever else) does work. Here look at this jsfiddle:
    http://jsfiddle.net/5nMzr/

IMN logo majestic logo threadwatch logo seochat tools logo