Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app
Prototype has a powerful API for accessing and manipulating the Document Object Model, A.K.A the DOM. The following code will let you interact with a simple web form.
Suppose we have a form that contains hidden/or locked inputs and they need to be updated dynamically. If the user changes a select field or if a checkbox is de/selected, other values in the form need updating. This could be required when products have options and associated price points. If you want to offer the user the option to switch options without refreshing or navigation this is a simple and effective approach.
... Sample form...
<input type="hidden" name="option_plan_id" id="option_plan_id" value="1"><br/> <input type="hidden" name="amount" value="150" id="amount">
<select name="select-plan" id="select-plan"> <option value="1, 150"> USD 150 - 1 person </option> <option value="2, 200"> USD 200 - 2 people </option> </select>
Thats it for now!