Mitch Causin
Mitch Causin

Reputation: 1

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

Upvotes: 0

Views: 150

Answers (2)

Jasper
Jasper

Reputation: 75993

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/

Upvotes: 0

maxedison
maxedison

Reputation: 17553

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

Upvotes: 1

Related Questions