javascript - jQuery way to Replace character from a string -
i have generated navigation, first n items have _
in front of them @ top of list. want accomplish remove _
front-end of site.
i tried jquery code below worked changing text of other nav items.
see full mark-up on js fiddle: https://jsfiddle.net/1fz661o4/
code:
$(function() { $('.dropdown-submenu').html($('.dropdown-submenu').html().replace(/\_/g,'')); });
you change loop on anchors.
$(function() { $('.dropdown-submenu > a').each(function() { $(this).text($(this).text().replace(/\_/g, '')); }); });
Comments
Post a Comment