JSFiddle - React, Tailwind, and code Playground

HTML

<!doctype html>
<head>
    <meta charset="utf-8">

    <title>Testing Button</title>
</head>

<body>

<form id="testForm" action="." method="POST">
    <div id="buttonArea">
        <button id="staticButton" type="button">Static Button</button>
        <button id="staticButtonJS">Static Button Normal JS</button>
    </div>
    
    <input type="submit" value="button" />
</form>
    
</body>
</html>

JavaScript

;(function($){
    $(function(){
        $('#testForm').submit(function() {
            alert('Form was submitted.');
            
            return false;
        });
        
        $('#staticButton').click(showType);
        
        $('<button />', {
            type: 'button',
            text: 'Test Button'
        })
            .click(showType)
            .appendTo($('#buttonArea'));
        
        $('<button />', {
            text: 'Test Button 2'
        })
            .attr('type', 'button')
            .click(showType)
            .appendTo($('#buttonArea'));
        
        $('#staticButtonJS').click(function(){
            this.type = 'button';
            
            alert('using .type: ' + $(this).attr('type'));
            
            this.setAttribute('type', 'button');
            
            alert('using .setAttribute(): ' + $(this).attr('type'));
        });
    });
    
    function showType() {
        alert('Button has a type of: ' + $(this).attr('type'));
        
        return false;
    }
})(jQuery);