简体   繁体   中英

Need help populating 2 form fields using a link?

I have a form with 2 input fields. With the click of a link I would like to populate these 2 form fields. I posted on jsfiddle ( http://jsfiddle.net/6AMNb/9/ ) what I have so far but I believe my syntax is incorrect somewhere. Any help would be HUGELY appreciated! Thanks, Mitch

.populate() is not a default method of jQuery. You need to include the Populate plugin .

Here is an example of populating the form inputs: http://jsfiddle.net/jasper/6AMNb/12/

I added the following code to your click handler for the .AddCart link.

$('#QOCode').val('ML10854');
$('#QOQty').val('1');

--UPDATE--

I changed the code to increment the quantity on subsequent clicks of the .AddCart link: http://jsfiddle.net/jasper/6AMNb/14/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM