zoukankan      html  css  js  c++  java
  • jQuery .attr("checked")得undefined 问题解决

    出现此错误是因为JQuery版本升级的问题。所以此处应该使用.prop();

    那么,什么时候使用attr(),什么时候使用prop()?
    1.添加属性名称该属性就会生效应该使用prop();
    2.是有true,false两个属性使用prop();
    3.其他则使用attr();
    项目中jquery升级的时候大家要注意这点!

    以下是官方建议attr(),prop()的使用:

    Attribute/Property.attr().prop()
    accesskey  
    align  
    async
    autofocus
    checked
    class  
    contenteditable  
    draggable  
    href  
    id  
    label  
    location ( i.e. window.location )
    multiple
    readOnly
    rel  
    selected
    src  
    tabindex  
    title  
    type  
    width ( if needed over .width() )  
  • 相关阅读:
    cygwin mysql forget root password
    emacs 复制粘贴的正确姿势
    yarn
    mysql 和 postgresql 区别
    hdfs
    spark
    hbase
    kafka
    flume
    java jar
  • 原文地址:https://www.cnblogs.com/pocn/p/5314084.html
Copyright © 2011-2022 走看看