Last Updated: April 14, 2016
·
30.78K
· iondrimba

Remove all except first item on a html select list (jQuery)

var selectList = $("whatever-selector");
selectList.find("option:gt(0)").remove();

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside