jquery - Remove text after element -
i trying remove text after icon.
<i class="flagstrap-icon flagstrap-as" style="margin-right: 10px;">x</i>france $('.flagstrap-icon').next().remove();
the problem next() not work without element.
example <span>france</span>
any idea remove text after icon?
jquery can't target nodes aren't elements, plain js can
$('.flagstrap-icon').get(0).nextsibling.remove()
note uses native remove()
, not supported in older browsers, if have support those, you'd do
var node = $('.flagstrap-icon').get(0).nextsibling; node.parentnode.removechild(node);
Comments
Post a Comment