tags:

views:

315

answers:

7

I am trying to hide all the tags in html that are <input type=radio>

I had this css

input{display: none}

However, this is hiding even buttons because they are <input type=button>

is there a way to hide just intput of type radio?

I can use jquery if need be but if it can be done via js or better yet just CSS then I'll prefer that...

I am using IE6 so no CSS3

+4  A: 
$("input[type='radio']").css("display","none");
Jonathan Sampson
+2  A: 
input[type="radio"]{display:none;}

I don't think this is CSS3. Should be CSS2.

synhershko
Just checked on Quirksmode - not available in IE6: http://www.quirksmode.org/css/selector_attribute.html
Perspx
CSS 2.1. IE 6 doesn't support it unfortunately.
tj111
I wish IE 6 would go away.
Troggy
Apparently the importance of jQuery is mainly to let us perform such tasks also in IE6 :)
synhershko
+1  A: 

What you are trying to do is easily accomplished with CSS Attribute selectors but those are not supported by IE6.

The only other way to do it with CSS would be to give all your input radio elements a common CSS classname and use that to select in CSS.

Miky Dinescu
+1  A: 

with jquery:

$("input[type='radio']").hide()

http://docs.jquery.com/Selectors

Carl Hörberg
+3  A: 

This jQuery snippet does the trick:

$(document).ready(function(){
    $(":radio").hide();       
});
Jose Basilio
A: 

A simple JavaScript solution that should work on IE6:

function hideAllRadioButtons()
{
    var elems = document.getElementsByTagName('input');
    for (var i = 0; i < elems.length; i++)
    {
        var e = elems[i];
        if (e.type === 'radio')
        {
            e.style.display = "none";
        }
    }
}
Sebastian Celis
A: 

If you don't want to use jQuery, straight up Javascript would be...

var inputs = document.getElementsByTagName('input');
for(var i=0; i < inputs.length; i++)
    if(inputs[i].type == 'radio')
        inputs[i].style.display = 'none';

Personally, I think the jQuery version is better, but if you don't want to include the library it this is your answer.

Symphony