I have the following javascript function in the <head> to toggle visibility of a <div>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
function toggleAndChange(aID,divID) {
$(divID).toggle();
if ($(divID).css('display') == 'none') {
$(aID).html('Show Description');
} else {
$(aID).html('Hide Description');
}
}
</script>
In the <body> I have the following code
<a id="description_visibility" href="javascript:toggleAndChange(description_visibility,description);">Hide Description</a><br />
<div id="description">....</div>
This works fine in IE and Chrome. In FF when I click on the link nothing happens. When I have up Firebug and click on the link it says:
description_visibility is not defined
Why does FF not recognize the <a> id? Or am I missing something? Issue on both FF 9.0.1 on my Mac and FF 8.0.1 on my PC
You have to use a single quotes for ‘#description_visibility’ and ‘#description’
And also numeral signs to specify that those are IDS