Is it possible to print a variable alongside text using .text?
This is my code currently but it doesn't seem to work
var rowCount = $('#result li').length;
$('#count').text((rowCount)"results for");
thanks for your help
Is it possible to print a variable alongside text using .text?
This is my code currently but it doesn't seem to work
var rowCount = $('#result li').length;
$('#count').text((rowCount)"results for");
thanks for your help
Try to use this :
var rowCount = $('#result li').length;
alert($('#count').text(rowCount+"results for"));
Yes sure it's possible. If I understand you correctly you want the variable printed along with some text.
var rowCount = $('#result li').length;
$('#count').text(rowCount + " results for");
or es6
var rowCount = $('#result li').length;
$('#count').text(`${rowCount} results for`);