I'm using basic jQuery to render tab data. I was wondering if anybody could comment on how to refactor the click() event handlers, and any general guidance or advice.
Here's the code/output in jsFiddle
Please see snapshot below of the main lines of code I'd like to clean up.
It would also be great if you can point me to any resources that might be beneficial.
('#tab1').click(function() {
$("#page").empty().html("<p>Here is our menu: Crispy Duck, Shrimp Tempura, Christmas Roll</p> ");
$("a").removeClass("active");
$(this).addClass("active");
});
$("#tab2").click(function() {
$("#page").empty().html("<p>We're located at: 13352 Minnieville Rd., Woodbridge, VA </p>");
$("a").removeClass("active");
$(this).addClass("active");
});
$("#tab3").click(function() {
$("#page").empty().html("<p>We can be reached at: (555)555-5555.</p>");
$("a").removeClass("active");
$(this).addClass("active");
});