Reputation: 1015
var temp="path.png"
How can I pass temp var into the jquery function as shown below
$('#mapfoto').prepend('<img id="theImg" src="http://path.gr/"+temp />')
Upvotes: 0
Views: 65
Reputation:
$('#mapfoto').prepend('<img id="theImg" src="http://path.gr/' + temp + '" />');
Upvotes: 1
Reputation: 145408
Use correct quotes placement in string concatenation:
$('#mapfoto').prepend('<img id="theImg" src="http://path.gr/' + temp + '" />');
Upvotes: 1