I have the following;
<div class="pin">
<p class="pin-text hidden">text</p>
</div>
and JS:
form.on('mouseover', '.pin', function(e) {
var id = this.id;
if($('#' + id).children('p.pin-text').length) {
pin_text_width = ($('#' + id).children('p.pin-text').parent().width()).toString() + 'px';
pin_text = $('#' + id).children('p.pin-text').text();
}
});
I need to find the paragraph's text width in order to size a PNotify tooltip with variable width:
tooltip = new PNotify({
text: pin_text,
width: pin_text_width,
....
How can I calculate the text (words) width?