Reputation: 31
When my button is clicked, I want two functions to run. The Choose button turns grew (which is working), however I also want the value of the sign up button at the bottom to change to 'sign up to gold'. However this isn't working, would be great if someone could help making these 2 functions run! :)
https://jsfiddle.net/u0n6v8zr/
<div class="homepagemembershippricingtable">
<ul class="price">
<li class="homemembershiptableheader">Platinum</li>
<li class="homemembershiptableprice"><p class="membershippricetext">£10</p> / month</li>
<li class="homemembershiptablecredits">3 credits, monthly</li>
<li class="membershipchoosebutton"><button type="button" class="chooseemembershipbutton" onClick="setusermembershipchoice('Platinum');setmembershipayment()">Choose</button></td>
</ul>
</div>
Upvotes: 1
Views: 59
Reputation: 870
The function setmembershipayment
is not closed, so the browser doesn't run the function because it founds an error.
You forgot a close bracket. Update your function as the following example and it will work fine.
function setmembershipayment(){
if (usermembershipchoice == "Silver") {
alert("PAY FOR SILVER");
document.getElementById("signupbutton").value = "SIGN UP TO SILVER";
} else if (usermembershipchoice == "Gold") {
document.getElementById("signupbutton").value = "SIGN UP TO GOLD";
alert("PAY FOR GOLD");
} else if (usermembershipchoice == "Platinum") {
document.getElementById("signupbutton").value = "SIGN UP TO PLATINUM";
} else {
alert("ERROR");
} // THE MISSED BRACKED!! ;)
}
Upvotes: 1