This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" name="message"> | |
<button type="button" class="show-message">Show The Message...</button> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> | |
<script type="text/javascript"> | |
// wait for someone to click on a button | |
$(".show-message").click(function() { | |
// get the value of the input, and show it in a dialog | |
alert( $("input[name='message'").val() ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" name="message"> | |
<button type="button" class="show-message">Show The Message...</button> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> | |
<script type="text/javascript"> | |
// wait for someone to click on a button | |
$(".show-message").click(function() { | |
// get the value of the input, and show it in a dialog | |
// preface it with another string of text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p> | |
<input type="text" name="input-a"> | |
<span>+</span> | |
<input type="text" name="input-b"> | |
<p> | |
<button type="button" class="calculate">Add them up</button> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> | |
<script type="text/javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" name="message"> | |
<button type="button" class="show-message">Show The Message...</button> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> | |
<script type="text/javascript"> | |
// wait for someone to click on a button | |
$(".show-message").click(function() { | |
// get the value of the input, and show it in a dialog | |
// preface it with another string of text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<input type="text" name="message"> | |
<button type="button" class="show-message">Show The Message...</button> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> | |
<script type="text/javascript"> | |
// wait for someone to click on a button | |
$(".show-message").click(function() { | |
// store value of the input a variable | |
var inputValue = $("input[name='message'").val(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var machine = "dish" + "washer"; | |
alert(machine); // triggers a dialog box with the text "dishwasher" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var total = 4 + 2; | |
alert(total); // shows "6" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var total = 4 + "2"; | |
alert(total); // shows "42" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var total = 4 + parseInt("2"); | |
alert(total); // shows "6" again! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var total = 4 + parseFloat("3.5"); | |
alert(total); // shows "7.5"! |
OlderNewer