Can you load a random file each time you click the same button with jQuery? -
i have 4 contact forms rotate testing. don't want run these in separate campaigns , such simple thing overkill. possible have group of 4 forms , load them randomly ( different form ) each time click button?
$(function() { $("a.random")click.(function){ //? }); });
yes.
<form id="form0" class="test_form"> <form id="form1" class="test_form" style="display: none;"> <form id="form2" class="test_form" style="display: none;"> <form id="form3" class="test_form" style="display: none;">
$(function() { $("a.random")click.(function){ $(".test_form").hide(); var formnumber = math.floor(math.random() * 4);//will equal number between 0 , 3 $("#form" + formnumber).show(); }); });
Comments
Post a Comment