Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS decorated button becomes inactive and unclickeable

After customizing a button with CSS the decoration is applied properly but the button becomes inactive, I cannot click on it and it won't submit.

Here is the code:

.addToCart {
width: 100px;
border-radius: 4px/4px;
border: 2px #E8CD00;
height:20px;
text-align: center;
vertical-align: center;
font-family: "Trebuchet MS", sans-serif;
font-size: 13px;
font-weight: bold;
padding: 1px;
background-color: #E8CD00;
color: black;
}

<form name="cartAdding">
<input type="hidden" name="productid" />
<input type="hidden" name="command" />
</form>
<input type="submit" value="ADD TO CART" class="addToCart" onclick="addtocart(<?php $itemId?>)" />
like image 952
samyb8 Avatar asked Dec 05 '25 17:12

samyb8


2 Answers

You need to move the input into the form element.

<form name="cartAdding">
    <input type="hidden" name="productid" />
    <input type="hidden" name="command" />
    <input type="submit" value="ADD TO CART" class="addToCart" onclick="addtocart(<?= $itemId ?>)" />
</form>
like image 121
Jeff Miller Avatar answered Dec 08 '25 10:12

Jeff Miller


Put the button inside the

<form> 

tags. Also keep in mind that clicking the button will submit the form, and unless your Javascript function returns false, you may see unexpected activity.

like image 25
turiyag Avatar answered Dec 08 '25 11:12

turiyag



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!