Actually I want something like that:
var color = #000;
$(".div").find("li").css({"border-left": '5px solid [`I want to add this variable (color) here`]});
Please help me.
Thank you.
Actually I want something like that:
var color = #000;
$(".div").find("li").css({"border-left": '5px solid [`I want to add this variable (color) here`]});
Please help me.
Thank you.
If you can use ES6 then a template literal is a good choice here. It uses backticks instead of other types of quotes.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals
var color = "#000"; //change this to be a string as @Nikos mentioned
$(".div").find("li").css({"border-left": `5px solid ${color}`});
var color = #000 missing quotes?