I'd like to hide the corresponding button when an input value is empty or has a value="n/a".
In the following example, the input box "boat" is corresponding with the button "button_boat", and the input box "car" with the button "button_car", and the input box "dog" with the button "button_dog".
Note: you cannot change the properties of the input element with type="text".
Without script the output will look like this:HTML Code:<div> <form action=""> <fieldset> <input type="text" name="boat" id="boat" disabled="disabled" value="n/a"> <input type="text" name="car" id="car" disabled="disabled" value="2"> <input type="text" name="dog" id="dog" disabled="disabled" value=""> </fieldset> </form> </div> <div> <div id="button_boat"><input type="button" value="Boat"/></div> <div id="button_car"><input type="button" value="Car"/></div> <div id="button_dog"><input type="button" value="Dog"/></div> </div>
hide_button_when_input_value_is_empty_before.gif
With script the output will look like this:
hide_button_when_input_value_is_empty_1.gif
Anyone know a Javascript that can do this?



Reply With Quote




Bookmarks