Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

disable div tag elements in FF2

Status
Not open for further replies.

NuJoizey

MIS
Aug 16, 2006
450
US
i have searched around and found some code claiming to do this, but it seems not to be working for me. I want to be able to disable several radio button elements under a single div element in one shot, if possible. All the code I have tried only works in IE - One workaround seems to be disabling each individual radio button, but what a pain. I've tried the following:

Code:
//works in IE not FF
var myVal = document.getElementById('myDiv');
ValidatorEnable(myVal, false);  


//works in IE not FF
var theDiv = document.getElementById('myDiv')
var theFields = theDiv.getElementsByTagName('input');
for (var i=0; i < theFields.length;i++) theFields[i].disabled=true; 
theDiv.disabled=true;


//ditto
var el = document.getElementById('myDiv')
for (var x = 0; x < el.childNodes.length; x++)
{
    el.disabled = el.disabled=true;
}

any suggestions?
 
Try:
Code:
el.disabled = 'disabled';

...disabling each individual radio button, but what a pain...
Write the code once and let the computer feel the "pain" of doing it repeatedly. It's hardly something to stress about - it's the way you are going to have to do it anyway [smile]

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
thanks jeffy, but that one didn't seem to work for me.

so yes, i ended up using a loop. but it just irks me when you can do something in one browser and not another - I really should learn to get over that. ....plus it would just be shorter, yes albeit not that much, but still......
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top