Skip to content

Instantly share code, notes, and snippets.

@keiththomps
Created May 5, 2014 20:07
Show Gist options
  • Save keiththomps/11546297 to your computer and use it in GitHub Desktop.
Save keiththomps/11546297 to your computer and use it in GitHub Desktop.
javascript:$('.first-name').val("Test");
$('.middle-initial').val("T");
$('.last-name').val("Testerson");
$.each( $("#traveler-details").children("table").children("tbody").children("tr"), function(index, value) { var $ageHtml, $dobHtml, year, age, ageString;
year = new Date().getFullYear();
$ageHtml = $(value).find(".age label");
$dob = $(value).find("input.dob");
age = year - $ageHtml.text();
ageString = "1/1/" + age;
$dob.val(ageString);
});
$('#order_home_address_attributes_address_1').val("1234");
$('.email').val("kthompson@squaremouth.com");
$('.city').val("Fake");
$('.zip').val("12345");
$('.phone').val("123-456-7890");
$('#order_credit_card_attributes_card_type_visa').click();
$('#order_credit_card_attributes_number_0').val("4111");
$('#order_credit_card_attributes_number_1').val("1111");
$('#order_credit_card_attributes_number_2').val("1111");
$('#order_credit_card_attributes_number_3').val("1111");
$month = $('#order_credit_card_attributes_expiration_date_month');
$year = $('#order_credit_card_attributes_expiration_date_year');
var select_month = $month.children().last().val();
var select_year = $year.children().last().val();
$month.val(select_month);
$year.val(select_year);
$('#order_credit_card_attributes_name').val("Keith T Testerson");
$('#order_billing_code_address_attributes_zip').val("12345");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment