This is the last problem with my form (hopefully)
What I want to do is add the size var to my hidden input named my-item-name
I tried to add this
form.find('[name=my-item-name]').append(size.val());
but that will not work.
What is the correct way to add val value to input?
<form method="post" action="" class="jcart"> <fieldset> <input type="hidden" name="jcartToken" value="13823c48f896c49403465fcce9f135ac" /> <input type="hidden" name="my-item-id" value="12" /> <input type="hidden" name="my-item-price" value="15.99" /> <input type="hidden" name="my-item-url" value="http://yahoo.com" /> <input type="hidden" name="my-item-name" value="Operation Braveheart hooded sweatshirt" /> <ul> <li> <select name="my-select" id="foo12"> <option value='Small'>Small</option> <option value='Medium'>Medium</option> <option value='Large'>Large</option> <option value='X-Large'>X-Large</option> </select> </li> <li>Price: $<span id="price12" class="price">15.99</span></li> <li> <label>Qty: <input type="text" name="my-item-qty" value="1" size="3" /></label> </li> </ul> <input type="submit" name="my-add-button" value="add to cart" class="button" /> </fieldset> </form> <script type="text/javascript"> var item_prices_by_size12 = { "Small": { "Price": "15.99", "ItemId": "9-1" },"Medium": { "Price": "16.99", "ItemId": "9-2" },"Large": { "Price": "17.99", "ItemId": "9-3" },"X-Large": { "Price": "18.99", "ItemId": "9-4" }}; $(function() { $('#foo12').change(function() { var form = $(this).parents('form'); </script>
source share