So I am using simple toggle function. To display text when a link is clicked. I am doing it over a class name because the divs are generated dynamically in a query.
What I want to do is change the "Display Text" to "Close Text" but I cant seem to get it to work.
Here is my js
Here is the line where I am calling it.
I am dynamically generating div and class ids using a query . When I click display text the toggle works fine. I can see the correct paragraph open , but the text does not change to "Close text
What I want to do is change the "Display Text" to "Close Text" but I cant seem to get it to work.
Here is my js
Code:
<script>
var allPageTags = new Array();
function toggle(theClass,x)
{
var allPageTags=document.getElementsByTagName("*");
for (i=0; i<allPageTags.length; i++)
{
if (allPageTags[i].className==theClass)
{
if( allPageTags[i].style.display=='none' )
{
allPageTags[i].style.display = '';
d = "document.getElementById(\'"+x+"\').innerHTML";
//alert(document.getElementById('LText1').innerHTML);
alert(d);
d = 'Close Text';
}
else{
allPageTags[i].style.display = 'none';
}
}
}
}
</script>
Here is the line where I am calling it.
Code:
<A href="javascript:toggle('inviclass#query.CurrentRow#','LText#query.CurrentRow#');"><div id='LText#query.CurrentRow#'>Display Text</div></A>
I am dynamically generating div and class ids using a query . When I click display text the toggle works fine. I can see the correct paragraph open , but the text does not change to "Close text