locked
Enable event RRS feed

  • Question

  • User364663285 posted

    Hi,
    How to enable click event to button below

    				                    <button type="button" >Login</button>
    

    to call this?

    $(function() {
       $('form').submit(function(e) {
       ...
    

    Thursday, March 12, 2020 6:48 AM

Answers

  • User288213138 posted

    Hi wmec,

    How to enable click event to button below

    According to your description, I couldn’t understand your requirement clearly.

    As patriceSc said, If you want to fire the click event, you only need to put the event below jquery function.

    $(function () {
        $("").click(function () {
                   });
            })

    $('form').submit(function(e) {

    The submit() Method display an alert when a form is submitted.

    If I misunderstand your requirement, please post more details information about your requirement.

    Best regards,

    Sam

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 12, 2020 8:21 AM

All replies

  • User753101303 posted

    Hi,

    With id="btn" added to the button you are usually doing something such as:

    <script>
    $(document).ready(function(){
      $("#btn").click(function(){
        // whatever you want...
      });
    });
    </script>

    ie you define a function that runs once the page is loaded and that will attach  a function to this button for its click event to tell what should be done when it happens.

    Or uou have a particular problem ? F12 Console or F12 Network can help to better see what happens before trying to solve the exact problem you found.

    Edit: try perhaps https://www.w3schools.com/jquery/default.asp if needed.

    Thursday, March 12, 2020 7:39 AM
  • User288213138 posted

    Hi wmec,

    How to enable click event to button below

    According to your description, I couldn’t understand your requirement clearly.

    As patriceSc said, If you want to fire the click event, you only need to put the event below jquery function.

    $(function () {
        $("").click(function () {
                   });
            })

    $('form').submit(function(e) {

    The submit() Method display an alert when a form is submitted.

    If I misunderstand your requirement, please post more details information about your requirement.

    Best regards,

    Sam

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 12, 2020 8:21 AM
  • User-474980206 posted

    assuming the button is inside the form change to submit:

    <button type="submit" >Login</button>

    if its outside the form its:

    <button type="button" onclick="$('form').submit()">Login</button>
    Thursday, March 12, 2020 3:45 PM