Home >Web Front-end >JS Tutorial >JQuery dynamically adds Select's Option element implementation method

JQuery dynamically adds Select's Option element implementation method

高洛峰
高洛峰Original
2017-01-03 16:45:561384browse

As shown below:

var selector=$(&#39;<select></select>&#39;); 
for(var i=0;i<5;i++){ 
  selector.append(&#39;<option value="&#39;+i+&#39;">&#39;+i+&#39;</option>&#39;); 
}

The above method of JQuery dynamically adding the Option element of Select is all the content shared by the editor. I hope It can give you a reference, and I hope you will support the PHP Chinese website.

For more articles related to JQuery’s method of dynamically adding Select’s Option element, please pay attention to the PHP Chinese website!


Statement:
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