"TEST: Hello Button"
Bootstrap 3.2.0 Snippet by mrmccormack

<link href="//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>TEST: Hello Button with jQuery</h2> <button type="button" id="btnHello" class="btn btn-primary">Hello World!</button> <button type="button" id="btnReset" class="btn btn-danger">Reset</button> </div> </div>
$( document ).ready(function() { // Event binding using a convenience method // Reference: http://learn.jquery.com/events/introduction-to-events/ $( "#btnHello" ).click(function( event ) { alert( "Hello World.- I'll change the name of button for you now." ); $("#btnHello").html('Goodbye World!'); }); $( "#btnReset" ).click(function( event ) { // alert( "Hello World.- I'll change the name of button for you now." ); var txt; var r = confirm("Are you sure you want to Reset"); if (r == true) { txt = "Hello World!"; // txt = $(#btnHello).attr("value")); //alert($(#btnHello).attr("value")); } else { txt = "Goodbye World!"; } $("#btnHello").html(txt); }); });

Related: See More


Questions / Comments: