Click to See Complete Forum and Search --> : Hide a tag?


lnahum
September 28th, 2008, 12:43 AM
I am not really sure it is ajax related but I think it is so.

I need a very simple code that will hide tag when I push the related button.

for example pressing "button red" will hide all the rows of the table that their background is defined as red or all the texts that are under a "red" tag (<red></red>). when another click will make them appear again.
the same will happen with the blue, green etc...

PeejAvery
September 28th, 2008, 05:59 AM
That would be JavaScript, not AJAX.

You can hide and show HTML elements by simply changing their style attribute.

function toggle(obj) {
obj.style.display = (obj.style.display == '') ? 'block' : '';
}

Another concern...Using your own tag named <red> would cause HTML validation errors. Why don't you just use a class or some other attibute of the <tr>?

PeejAvery
September 28th, 2008, 06:00 AM
[ moved ]