JQuery - Add Text And Var To Value
I want to add normal text and a jQuery value to an input value. var amount = $('option:selected', this).val(); $('.customfield').val('clicks,
Solution 1:
Try this:
$('.customfield').val('clicks,<?php echo $userdata["id"] ?>,' + amount);
//--------double quote to id as is open and ---------^^^^
// closed by single quote and remove last +
Solution 2:
var amount = $('option:selected').val();
$('.customfield').val('clicks,<?php echo $userdata['id'] ?>,' + amount);
Solution 3:
Try this
var amount = $('option:selected').val();
$('.customfield').val('clicks, <?php echo $userdata["id"] ?>,'+amount+');
Solution 4:
var amount = $('option:selected').val(); // or var amount = $('#selectDropwdownId').val();
$('.customfield').val("clicks,<?php echo $userdata['id'] ?>," + amount );
Post a Comment for "JQuery - Add Text And Var To Value"