Frage

I am having one combo box in that I need value in order by alphabetic.but problem is In that list OTHER one value need to come at last.

we can achieve this using value number arrange according to our need but it contain lot of value and using the key I did lot of process in java script so i take lot of changes to change one thing .

<select>
    <option value="Select" selected="selected">Select</option>
    <option value="147">Articles Of Association</option>
    <option value="135">Birth Certificate</option>
    <option value="132">Drivers License</option>
    <option value="145">Memorandum Of Articles</option>
    <option value="141">Others</option>
    <option value="148">Partnership Agreement</option>
    <option value="131">Passport</option>
</select>

so using script we can push the OTHER VALUE TO LAST in the list.

War es hilfreich?

Lösung

$("#list option").filter(function(){
    return $(this).text()==='Others'
}).appendTo("#list")

http://jsfiddle.net/SxtnF/

Andere Tipps

When you have created your list, like

<select id="mycombobox">
    <option value=" selected="selected">Select</option>
    <option value="147">Articles Of Association</option>
    <option value="135">Birth Certificate</option>
    <option value="132">Drivers License</option>
    <option value="145">Memorandum Of Articles</option>
    <option value="141">Others</option>
    <option value="148">Partnership Agreement</option>
    <option value="131">Passport</option>
</select>

At last, try to add Other like

$("#mycombobox").append('<option value="other">' + Other +'</option>');

This will solve your problem. Hope this will help you out.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top