douxiong3245 2016-05-04 17:58
浏览 20
已采纳

如何引用select元素? [重复]

This question already has an answer here:

I have 3 selection fields as following:

  • selection field 1
  • selection field 2
  • selection field 3

The selection field 1 and 2 are filled up through a simple MySql query. What I have to do is when user has selected one or several options from selection field 1 and 2, I need to perform an AJAX request to page2.php and then they will be returned some results. Fortunately this works well.

In page2.php there is a selection field with id select_field. The problem appears when I'm trying to reference this id from page1.php.

How can I resolve this problem?

</div>
  • 写回答

1条回答 默认 最新

  • dongyi1777 2016-05-04 18:04
    关注

    Use event delegation for binding events to dynamically added elements.

    $(document).on('click', '#select_field', function(){
        //your code
    })
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料