![]() |
| ||
| Selecting all input text fields Im looking for a piece of code that can be used to select all input text fields and then disable and enable them at will. I was trying to work off this: text = document.getElementsByTagName("input");
THEN when required: text.disable = true; Thanks, Regards X. |
| ||
| Re: Selecting all input text fields Quote:
Here is a javascript function that will enable or disable all input text fields: function setInputTextEnabled(isEnabled) You specify true or false for isEnabled depending on whether you want them all to be enabled or disabled. I've also checked that the type of input is 'text' as you said. If you want to affect all input's, remove the line that begins "if (inputArray..."). Quote:
Note that the variable 'text' holds an array, not a single object, so you have to specify indices as I did in the code above in order to change individual properties, such as: text = document.getElementsByTagName("input");
~ mellamokb |
| ||
| Re: Selecting all input text fields mellamokb my hero! ya i came up with similar code but it is not working, at the moment im trying to use a checkbox to implement the enable or disable ALL checkboxes but its not working =( Also any ideas on my other post on trying to stop a submit button from working? (idea was return false but no go still goes to next page) =( Ill try figure something out, keep you posted. ps: good heads up on the text array i overlook easy things sometimes =( |
| ||
| Re: Selecting all input text fields Here is full page source that works. I fixed a bug in the javascript I wrote, where I used a single equals where I should have used double equals for comparison: <html> ~ mellamokb |
| ||
| Re: Selecting all input text fields ~ mellamokb Dont ask me what the problem was. Ran your code worked perfectly, then ran mine and worked fine. Anyways beautiful work once again, you have helped me so much and gone that extra mile, THankyou =) |
| All times are GMT -4. The time now is 10:39 pm. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC