I am a new programmer so fogive me if this amateur... I am looking for some direction, or perhaps some ideas. I goal here is for me to learn, so any push in the right direction would be appreaciated.
ok.. I challenged myself to create a 'wizard' like control for a simple sign up form using jQuery. I can get through the steps quite nicely however I am looking at my code and I cant help but think; "there has to be a better, easier and proper way to do this". Here is what I have.
function toggleStep(){
$("#nextButton").click(function(){
if($("#nextButton").name = "step1"){
$("#nextButton").attr("name", "step2");
$("#backButton").attr("name", "step1").css("display", "inline");
$("#step1").hide();
$("#step2").show("fade", 250);
}
$("#nextButton").click(function(){
if($("#nextButton").name = "step2"){
$("#nextButton").attr("name", "step3");
$("#backButton").attr("name", "step2");
$("#step2").hide();
$("#step3").show("fade", 250);
}
$("#nextButton").click(function(){
if($("#nextButton").name = "step3"){
$("#nextButton").attr("name", "step4");
$("#nextButton").css("display", "none");
$("#backButton").attr("name", "step3");
$("#step3").hide();
$("#step4").show("fade", 250);
}
});
});
});
}
Also, I seem to have messed myself up when creating a "back button" function. This code is simply not good enough. How would you approach this? Thanks!!!