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.

有帮助吗?

解决方案

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

http://jsfiddle.net/SxtnF/

其他提示

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.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top