社区所有版块导航
Python
python开源   Django   Python   DjangoApp   pycharm  
DATA
docker   Elasticsearch  
aigc
aigc   chatgpt  
WEB开发
linux   MongoDB   Redis   DATABASE   NGINX   其他Web框架   web工具   zookeeper   tornado   NoSql   Bootstrap   js   peewee   Git   bottle   IE   MQ   Jquery  
机器学习
机器学习算法  
Python88.com
反馈   公告   社区推广  
产品
短视频  
印度
印度  
私信  •  关注

Milan Chheda guest271314

Milan Chheda guest271314 最近创建的主题
Milan Chheda guest271314 最近回复了
7 年前
回复了 Milan Chheda guest271314 创建的主题 » jquery函数不使用Ajax返回/呈现的页面[重复]

当使用 jQuery(html, attributes) .

自jquery 1.8起 ,任何jquery实例方法(方法 jQuery.fn )可以用作传递给的对象的属性 第二个参数:

function handleDynamicElementEvent(event) {
  console.log(event.type, this.value)
}
// create and attach event to dynamic element
jQuery("<select>", {
    html: $.map(Array(3), function(_, index) {
      return new Option(index, index)
    }),
    on: {
      change: handleDynamicElementEvent
    }
  })
  .appendTo("body");
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js">
</script>