I have the following block
<span id="title"><select id="optionType"><option>choose option</option><option> hello</option><option>how are you</option></select></span>
I want to remove the first option and need to get the all other options in new line, only the option text with out any tags . Is regular expression is the best one to use, or is thire any other better method to retrieve text in new line ? I tried the following but it can fail somtimes
Description= $('title').innerHTML;
var tmp = Description;
tmp = tmp.replace("--Choose an option--</option>",""); // remove first option
tmp = tmp.replace(/<\/option><option>/g, "<\/option>\n<\/option>");
tmp = tmp.replace(/(<([^>]+)>)/g,"");
tmp = tmp.replace(/\n/g, "\n");
tmp = tmp.replace(/^[\s]*/gm, '');
return tmp;