Removing all values but the first from a drop down list using jQuery

Handware

New Member
\[code\] if (questions[0]) { $("select[id$=ddlPollQuestions] > option").remove(); $('#ddlPollQuestions').append('<option value="">Choose a question to compare to</option>'); $.each(questions, function(i, question) { $('#ddlPollQuestions').append('<option value="' + question.QUESTIONID + '">' + question.TEXT + '</option>'); }); } else { $("select[id$=ddlPollQuestions] > option").remove(); $('#ddlPollQuestions').append('<option value="' + 0 + '">' + 'There are no questions of this type' + '</option>'); }\[/code\]What this does is it removes all the previous values, But i want my first option, which is "Choose a question ..." to remain, and then display "There are not questions..." as my 2nd option. My code here does not show "Choose a question.." as the first option. Thanks for having a look!
 
Top