Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. var z = false;
  2. function onLoad(el, callback){
  3. var timer = setInterval(function(){
  4. if(el.length !== 0){
  5. callback();
  6. clearInterval(timer);
  7. }
  8. }, 1)
  9. }
  10.  
  11. function ss(el,i){
  12. el.find("option[value='" + i + "']").attr("selected", "selected");
  13. }
  14.  
  15. function step1(){
  16. var i = {
  17. "your name": "Sunil Chadha",
  18. "email": "sunilchadha@yahoo.com",
  19. "telephone (required for entry)": "(917) 604-1950",
  20. "s": "Brooklyn"
  21. };
  22. $('label').each(function(){
  23. var g = $(this); var v = g.text(); var h = i[v];
  24. if(h){g.parent().find("input").val(h);}
  25. if(v == i["s"]){g.click(); z = true;}
  26. });
  27. $("#step_1_button").click();
  28. }
  29.  
  30. function step2(){
  31. var i = {
  32. "billing address": "954 78th Street",
  33. "billing address 2": "",
  34. "zip": "11228",
  35. "city": "Brooklyn",
  36. "credit card number": "4262 9051 0836 2174",
  37. "cvv": "348",
  38. "s1": "NY",
  39. "s2": "12", // Exp MONTH
  40. "s3": "2023" // Exp Year (4 letters)
  41. };
  42. $('label').each(function(){
  43. var g = $(this); var v = g.text(); var h = i[v]; var k = g.parent().find("select");
  44. if(h){g.parent().find("input").val(h);}
  45. if(v=="state"){ss(k,i["s1"]);}
  46. if(v=="exp. month"){ss(k,i["s2"]);}
  47. if(v=="exp. year"){ss(k,i["s3"]);}
  48. });
  49.  
  50. $('input').each(function(){
  51. var o = $(this);
  52. if(o.is(":visible") && o.val().length == 0){o.css("border", "4px solid yellow");}
  53. });
  54. $('select').each(function(){
  55. var o = $(this);
  56. if(o.val().length == 0){o.css("border", "4px solid yellow");}
  57. });
  58. if(!z){ $('.magic-radio').eq(0).parent().css('border', '3px solid yellow'); }
  59. }
  60.  
  61. onLoad($("#step_1_button"), step1);
  62. onLoad($("#submit_button"), function(){$("#step_2").show(); step2();});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement