I've been struggling to link a data value with a dynamically created div, but so far I haven't had any success. I've searched online for solutions, but I can't find any examples that fit my specific issue. If anyone has any advice, I would greatly appreciate it. The error message I keep encountering is:
.data is not a function
Whenever I try using the $
operator in my code, it doesn't seem to have any effect and the code just runs without any change.
var container = $("#container");
('<div class="orb"></div>').data(num).appendTo(container);