How is it possible to add css for the pseudo elements of the class dynamically.
<?php if ($_option->getDescription()): ?>
<span class="questiontooltip-wrap">
<p class="questiontooltip" id="tooltip_<?php echo $_option->getId()?>">?</p>
<p class="note" id="content_<?php echo $_option->getId()?>" style="display:none">
<?php echo $_option->getDescription() ?>
</p>
<?php endif; ?>
This is my script
<script>
jQuery(document).ready(function ($) {
//$(".note").hide();
$(".questiontooltip").click(function(){
var titleid = "#opt-title_"+res;
var titlewidth = $( titleid).outerWidth();//alert(titleht);
$(".note:after").css("left", titleht+"px");
//my actions
});
});
</script>
I have the width value in variable titlewidth. I want to add this value to the before and after elements of class .note dynamically. Is there any way to do this? I have tried the above way. But not working.