jquery - Chage text options in Wordpress -
i generated form wordpress plugin , can't put spaces on text. want change text of options this: unaestrella -> una estrella ... (not value text)
<select id="topics" class="taxonomies-filter-widget-input" name="topics"> <option value="0">todas</option> <option class="level-0" value="unaestrella">unaestrella</option> <option class="level-0" value="dosestrellas">dosestrellas</option> <option class="level-0" value="tresestrellas">tresestrellas</option> <option class="level-0" value="cuatroestrellas">cuatroestrellas</option> <option class="level-0" value="cincoestrellas">cincoestrellas</option> </select>
is possible change images?
i think want this
function cameltospc(str) { return str.replace(/([a-z\d])([a-z])/g, '$1 $2'); } $(function(){ $('select#topics option').each(function(){ var txt = $(this).text(); $(this).text(cameltospc(txt)); }); });
update :
make sure jquery
added , replace $
jquery
or try
(function($) { $('select#topics option').each(function(){ var txt = $(this).text(); $(this).text(cameltospc(txt)); }); })(jquery);
Comments
Post a Comment