Hi,
I am willing to place a button which, after it is pressed, displays other elements, so far I got that done without any problem. The hard part starts if I want to have few of those buttons and each of them to display/hide other content.
My javascript code which hides/shows content is:
<script>
function fade(div_id, button) {
if(button.value == 'Show content') {
$('#'+div_id).fadeIn('slow');
button.value = 'Hide content';
}
else {
$('#'+div_id).fadeOut('slow');
button.value = 'Show content';
}
}
</script>
The code for my button is simple input tag:
<input type="button" onclick="fade('content-div-id', this)" value="Hide content" class="content-button">
The problem is that the value of buttons change to the same as others after it is pressed, how should I modify the code above to make it work for multiple buttons?
PS. I am attaching html file to illustrate my problem.