Js solves "options is empty or not an object"

Source: Internet
Author: User

Yesterday I encountered a strange problem when I made an ip/pv statistics page. I put a select control on the page, when the Control id is selectMonth but the option is added dynamically using js, the script error is always prompted: "options is empty or not an object", but the document is used. form1.xx or document. getElementById can be used to obtain objects.

The reason cannot be found for a long time. There is no way to go around a long path. Put a div in the original select control, dynamically create a select using js, and then put the select into the div.

This is the case, but I have to add a select control on this page today. I am sorry for this. After searching for a long time, almost all the related files have been viewed, finally, I found in a js calendar control that a dynamic control was created in this js, And the id of this control was also named selectMonth. It was dizzy.

Solve the problem.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.