开发者

triggering an onchange event of a select box

I have a select box, which i can populate using two methods.

First - Just by selecting any one of the option in the select box.

Second - I have a link just beside the select box.Clicking this link takes me to a page2, which has the same options but as links in page2.When i click one of them , it populates the select box.

Selecting the option directly from the "select" triggers an onchange event in it. But when i click the link, select my required option from that page, it does not trigger the onchange event in the开发者_运维问答 select box. I am not sure where i am doing a mistake.

Thanks in advance.


This happens because the onchange is fired only when user does selection.

There's an easy workaround... have the JS code which populates the select box call the same JS code that is called from onchange trigger of the select.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜