Skip to content

Instantly share code, notes, and snippets.

@jlittlejohn
Created December 13, 2012 21:37
Show Gist options
  • Save jlittlejohn/4280183 to your computer and use it in GitHub Desktop.
Save jlittlejohn/4280183 to your computer and use it in GitHub Desktop.
JS: Retrieve Content Values
$("p").click(function () {
var htmlstring = $(this).html(); // obtain html string from paragraph
$(this).text(htmlstring); // overwrite paragraph text with new string value
});
var value1 = $('input#username').val(); // textfield input value
var value2 = $('input:checkbox:checked').val(); // get the value from a checked checkbox
var value3 = $('input:radio[name=bar]:checked').val(); // get the value from a set of radio buttons
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment