Last active
August 29, 2015 14:17
-
-
Save SMaguina/953e2199af962172c9bf to your computer and use it in GitHub Desktop.
Javascript/jQuery lesson 1 - script.js
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
Javascript Code: A textarea with it's background color changed via JavaScript | |
$("#message").ready(function(){ | |
$("#message").css("background-color", "pink"); | |
}); | |
Javascript Code: User input appears in the DOM on Submit | |
$("button").on("click", function(){ | |
console.log( "clicked" ); | |
var comment = $("#message").val(); | |
console.log(comment); | |
$("#visible-comment").html(comment); | |
}); | |
HTML Code: Add to index.html file below the Submit button: | |
<p id="visible-comment"></p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment