jQuery - 将text和var添加到值 [英] jQuery - add text and var to value
本文介绍了jQuery - 将text和var添加到值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将普通文本和jQuery值添加到输入值。
I want to add normal text and a jQuery value to an input value.
var amount = $('option:selected', this).val();
$('.customfield').val('clicks,<?php echo $userdata['id'] ?>,' + amount +);
这就是我所拥有的,但这不起作用。有人可以向我解释,它是如何完成的?
This is what I have, but that doesn't work. Can someone explain to me, how it's done?
推荐答案
试试这个:
$('.customfield').val('clicks,<?php echo $userdata["id"] ?>,' + amount);
//--------double quote to id as is open and ---------^^^^
// closed by single quote and remove last +
这篇关于jQuery - 将text和var添加到值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文