PDA

View Full Version : Onclick JS script to update code based on field input?


DrJ
Dec 12, 2011, 12:23 PM
Is there a way to write a JS code that will create an input field and a button. When the button is pressed, it will check the input field and if the correct code is entered into the field, it will update a snippet of code further down?

Basically, I have a hosted paypal button set at one price and a second hosted paypal button at a reduced price. I want to offer a promo code so if the user enters the correct promo code and clicks to activate the promo, it will update the id in the code for the paypal button to go the reduced price item instead without reloading the page.

Any ideas?