Hello,
I have these div tags, they're very similar but I just need to change the IDs. Is there anyway to condense this code?
$(document).ready(function(){
//Full Name
var changeName = $('#changeName');
var cancelName = $('#cancelName');
var fullnameDisplay = $('#fullnameDisplay');
var fullnameChange = $('#fullnameChange');
var helperName = $('#helperName')
changeName.click(function(){
$(this).hide();
cancelName.show();//link
fullnameChange.show();//inputs and all that
fullnameDisplay.hide();//display item
helperName.show();//instructions
cancelName.click(function(){
$(this).hide();
changeName.show();//link
fullnameChange.hide();
fullnameDisplay.show();
helperName.hide();
});
});
//Email
var changeEmail = $('#changeEmail');
var cancelEmail = $('#cancelEmail');
var emailDisplay = $('#emailDisplay');
var emailChange = $('#emailChange');
var helperEmail = $('#helperEmail')
changeEmail.click(function(){
$(this).hide();
cancelEmail.show();//link
emailChange.show();//inputs and all that
emailDisplay.hide();//display item
helperEmail.show();//instructions
cancelEmail.click(function(){
$(this).hide();
changeEmail.show();//link
emailChange.hide();
emailDisplay.show();
helperEmail.hide();
});
});
//Password
var changePass = $('#changePass');
var cancelPass = $('#cancelPass');
var passDisplay = $('#passDisplay');
var passChange = $('#passChange');
var helperPass = $('#helperPass')
changePass.click(function(){
$(this).hide();
cancelPass.show();//link
passChange.show();//inputs and all that
passDisplay.hide();//display item
helperPass.show();//instructions
cancelPass.click(function(){
$(this).hide();
changePass.show();//link
passChange.hide();
passDisplay.show();
helperPass.hide();
});
});
});
Thanks