jquery中attr和prop的区别
对于HTML元素本身就带有的固有属性,在处理时,使用prop方法。
对于HTML元素我们自己自定义的DOM属性,在处理时,使用attr方法。
<input id="chk2" type="checkbox" checked="checked" action="delate"/>
以上HTML中JQ获取属性
alert($("#chk2").prop("checked"));//true ,如果用attr那么就是undefined
alert($("#chk2").attr("action"));//true,如果用prop那么就是undefined
    记下点滴,等老了慢慢欣赏
 
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号