Ok, I have one empty div, which is dynamically filled with some content later:
<div class="row no-margin">
<div id="sensorInfoContent">
</div>
</div>
Later it is filled with some other divs and content. I need to select this child div:
<div class="circDash" id="batPerc" accesskey="30" style="height:100px; background-color:#000000;">
And call this function on it:
$(*DIV*).circleProgress({
value: 0.75,
size: 80,
fill: {
gradient: ["red", "orange"]
}
});
I tried to do that on click, and it's working. Like this:
$('#sensorInfoContent').on("click", ".circDash", function() {
$(this).circleProgress({
value: 0.75,
size: 80,
fill: {
gradient: ["red", "orange"]
}
});
});
But I need it to be done after element is dynamically added, not on click. Tried DOMNodeInserted, it's not working:
$('#sensorInfoContent').on("DOMNodeInserted", ".circDash", function() {
$(this).circleProgress({
value:
0.75,
size: 80,
fill: {
gradient: ["red", "orange"]
}
});
});
Any ideas, alternatives or work-arounds?
Just trigger the click manually
$('#sensorInfoContent').on("click", ".circDash", function() {
$(this).circleProgress({
value: 0.75,
size: 80,
fill: {
gradient: ["red", "orange"]
}
});
});
Like this
$('.circDash').trigger('click');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With