Skip to content

Instantly share code, notes, and snippets.

@SMaguina
Last active August 29, 2015 14:17
Show Gist options
  • Save SMaguina/953e2199af962172c9bf to your computer and use it in GitHub Desktop.
Save SMaguina/953e2199af962172c9bf to your computer and use it in GitHub Desktop.
Javascript/jQuery lesson 1 - script.js
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