javascript - separate first character from string -


i trying separate number first character of string rest of string. example 1options select should 1 options select.

please note select list dynamically generated

<select>     <option>1options select</option>     <option>2anything can here</option>     <option>3anything can here</option>     <option>5anything can here</option> </select>  $(".custom-ordered-list select option").each(function() {      //i think need loop through not sure next.                       }); 

i'd in following way:

$(".custom-ordered-list select option").text(function(i, text) {     return text.replace(/^\d+/, "$& "); }); 

demo: http://jsfiddle.net/63h7t/


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -