Data loading text on button

Total Post:52

Points:366
 539  View(s)
Ratings:
Rate this:
<body>

    <button type="submit" onclick="MyCustomFunction()" id="submit" class="btn btn-primary btn-lg mt-2" data-loading-text="Sending...">Submit message!</button>
</body>

I'm trying to add data-loading-text to my submit button, but it is not working ..


  1. Post:45

    Points:323
    Re: Data loading text on button

    Hi Manish..

    You can try this...

    <head>
    
        <style></style>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
        <script>
            function MyCustomFunction(){
                $("#submit").text("Loading...");
                $(this).submit('loading').delay(1000).queue(function () {
                    // $(this).button('reset');
                });
            }
        </script>
    </head>
    <body>
        <button type="submit" onclick="MyCustomFunction()" id="submit" class="btn btn-primary btn-lg mt-2" data-loading-text="Sending...">Submit message!</button>
    </body>
    </html>


Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!