Aleks Kpur Aleks Kpur - 2 years ago 97
jQuery Question

HTML/Javascript - Button onClick calling function with variables

So I have an online store, I have an button which calls a function called

, but in Javascript this function has
purchase(name, amount)
. So, you can put name easily, in the onclick function
, but my problem is how I could put the amount? Amount is being chosen from the

I created somekind of JSFiddle as well, so you can take a look:

Answer Source

Using jquery you could do this;

 <button class="button" onclick="payment('milk', $('select').val())">$1.85</button>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download