简体   繁体   English

需要使用链接填充2个表单字段的帮助吗?

[英]Need help populating 2 form fields using a link?

I have a form with 2 input fields. 我有一个带有2个输入字段的表单。 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. 我在jsfiddle( http://jsfiddle.net/6AMNb/9/ )上发布了到目前为止的内容,但我相信我的语法在某些地方不正确。 Any help would be HUGELY appreciated! 任何帮助将不胜感激! Thanks, Mitch 谢谢米奇

.populate() is not a default method of jQuery. .populate()不是jQuery的默认方法。 You need to include the Populate plugin . 您需要包括Populate插件

Here is an example of populating the form inputs: http://jsfiddle.net/jasper/6AMNb/12/ 这是填充表单输入的示例: http : //jsfiddle.net/jasper/6AMNb/12/

I added the following code to your click handler for the .AddCart link. 我将以下代码添加到.AddCart链接的点击处理程序中。

$('#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/ 我更改了代码,以在随后单击.AddCart链接时增加数量: http : //jsfiddle.net/jasper/6AMNb/14/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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