Skip to content

Instantly share code, notes, and snippets.

@qbmarketing
Created November 21, 2012 20:22
Show Gist options
  • Save qbmarketing/4127411 to your computer and use it in GitHub Desktop.
Save qbmarketing/4127411 to your computer and use it in GitHub Desktop.
copying fields in my form
Taking your advice to do it in jQuery, this is what I NOW have above the form:
<script type="text/javascript">
$(document).ready(function(){
$("input#same").click(function(){
if ($("input#same").is(':checked'))
{
// Checked, copy values
$("input#first_name").val($("input#order_first_name").val());
$("input#last_name").val($("input#order_last_name").val());
}
else
{
// Clear on uncheck
$("input#first_name").val("");
$("input#last_name").val("");
}
});
});
</script>
And then the checkbox is:
<input type="checkbox" id="same">
But it's still not working for me. Stumped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment