I have some jQuery where I am appending text where some of their attributes take some js variables.
<script>
var className = "COS 102";
var teacher = "Bob Teacher";
$("#classesDiv").append("<div className="+className+" teacher="+teacher+" class='class'></div>");
</script>
The issue I am having is that when I pass these variables into the element it comes out looking like className="COS"
, without the 102 after.
Does anybody know why this is happening?