I've got this JQuery:
var calBtn = $('#calButton').attr('value');
function disappearingTable() {
if (calBtn = 'Turn Calendar Off')
{
$('.calendarLayer').toggle();
$('#calButton').attr('value', 'Turn Calendar On');
}
else if (calBtn = 'Turn Calendar On')
{
$('.calendarLayer').toggle();
$('#calButton').attr('value', 'Turn Calendar Off');
}
}
And this in the HTML
<form id="calendarForm" action="javascript:void(0);">
<input type="submit" id="calButton" value="Turn Calendar Off" onclick="disappearingTable()" />
</form>
Here's what happens:
Page loads and displays a calendar. There is a button above the calendar (see above code) that says "Turn Calendar Off". I click on the button & the calendar disappears and the text changes to "Turn Calendar On". I click the button again & the calendar reappears, but my text is not changing back.
No errors are popping up in the FireBug console. I'm new to JQuery and Javascript.. so sorry if the problem is easily found.
Everything looks correct to me.. I'm banging my head here.
Any help would be appreciated.
Thanks


Sign In
Create Account



Back to top









