/    Sign up×
Community /Pin to ProfileBookmark

Enabling All Inputs!

Hi All,

I have the following code…

[CODE]var inputs = document.getElementsByTagName(‘input’);
for (i = 0; inputs.length; i++) {
inputs[i].disabled = false;
}[/CODE]

Its bringing up and error in FireBug but I cannot work out why for the life of me! Does anyone know why?

Maybe I’m just too tired!

Thanks!

dai.hop

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@apeaceDec 11.2008 — Check out your for loop...should be

for (i = 0; i < inputs.length; i++)

You ARE too tired ?
Copy linkTweet thisAlerts:
@mikemDec 11.2008 — Hi,

Have you omitted "i <" ?

[CODE]var inputs = document.getElementsByTagName('input');
for (i = 0; i < inputs.length; i++) {
inputs[i].disabled = false;
}[/CODE]


Mike
Copy linkTweet thisAlerts:
@mrhooDec 11.2008 — Best to measure the list just once, before the loop begins.
[CODE]
var inputs= document.getElementsByTagName('input');

for(var i= 0, L= inputs.length; i< L; i++){
inputs[i].disabled= false;
}[/CODE]
Copy linkTweet thisAlerts:
@dai_hopauthorDec 12.2008 — I must've been tired to miss that!

Tanks for your help everyone! ?
×

Success!

Help @dai_hop spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...