Clear the option before clearing the option in js. My approach is to traverse the existing option and make each of its child elements empty. Now using jQuery to implement it, we only need to call its supported empty method.
empty()
Delete all child nodes in the matching element set. In addition, we need to set the default value, so here is the method to clear all options under select, just use the following statement:
The previous method of dynamically creating option with js was to use its intermediate function to traverse the json object returned by Ajax. And use new Option to create option. Now I use the following method to process
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn