We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11413
    • 203 Posts
    As said in the title : I want to clear a select. I update the contentwith AJAX, but each query give me the whole list. How can I empty my <select> before adding some content to it??

    Thanks a lot!

    Blaise

    SOLUTION :

    Here is a Javascript function that I found on the net, modified to work better with less code :

    function removeChildrenFromNode(node) {
    		if(node)
    		{
    			while (node.hasChildNodes())
    			{
    				node.removeChild(node.firstChild);
    			}
    		}
    	}



    I hope it helps someone!
      Blaise Bernier

      www.medialdesign.com - Solutions for small business, hosting, design and more!