ich .split(" ")
ein Datenattributwert wollen, aber es gibt leer:.split() ein Datenattribut funktioniert nicht, wenn es sollte
var bulletcontent = jQuery(this).closest("div").find("p").attr('data-bcontent');
// split content into words
var words = jQuery(bulletcontent).text().split(" ");
Warum ist das nicht funktioniert?
Hier ist ein jsFiddle.
Warum Sie jQuery für String verwenden, benutzen Sie einfach 'bulletcontent.split (‘ ‚)' – jcubic
Warum Umwickeln Sie 'bulletcontent' in' jQuery' ? – Rayon
'jQuery (" Hallo Welt ")' wird Selektor sein, der das Tag Hallo mit dem Tag Welt innerhalb übereinstimmt. – jcubic