我想将普通文本和jQuery值添加到输入值。
var amount = $('option:selected', this).val();
$('.customfield').val('clicks,<?php echo $userdata['id'] ?>,' + amount +);
这就是我所拥有的,但这并不起作用。有人可以向我解释它是如何完成的吗?
答案 0 :(得分:1)
试试这个:
$('.customfield').val('clicks,<?php echo $userdata["id"] ?>,' + amount);
//--------double quote to id as is open and ---------^^^^
// closed by single quote and remove last +
答案 1 :(得分:0)
var amount = $('option:selected').val();
$('.customfield').val('clicks,<?php echo $userdata['id'] ?>,' + amount);
答案 2 :(得分:0)
var amount = $('option:selected').val(); // or var amount = $('#selectDropwdownId').val();
$('.customfield').val("clicks,<?php echo $userdata['id'] ?>," + amount );
答案 3 :(得分:0)
试试这个
var amount = $('option:selected').val();
$('.customfield').val('clicks, <?php echo $userdata["id"] ?>,'+amount+');