☆ ???http://www.jb51.net/article/114876.htm ????http://www.365mini.com/page/jquery-attr-vs-prop.htm ???https://www.cnblogs.com/smartXiang/p/5686800.html ?☆ ???<!DOCTYPE html> ????????????????????????????https://www.cnblogs.com/ipetergo/p/6491321.html ???<html> ???<head> ???<meta charset="utf-8"> ???<title>菜鸟教程(runoob.com)</title> ???<script src="http://cdn.static.runoob.com/libs/jquery/1.10.2/jquery.min.js"> ???</script> ???<script> ???$(document).ready(function(){ ???????$("button").click(function(){ ???????????$("#p1").html("attr(‘checked‘): " + $("input").attr(‘checked‘) ???????//checked ???????????????????+ "<br>prop(‘checked‘): " + $("input").prop(‘checked‘)); ???//true ???????}); ???}); ???</script> ???</head> ???<body> ???<p><b>注意:</b>确认或取消选中该复选框,然后单击按钮刷新内容。</p> ???<button>查看attr() 和 prop() 的值</button> ???<br><br> ???<input id="check1" type="checkbox" checked="checked"> ???<label for="check1">Check me</label> ???<p id="p1"></p> ???</body> ???</html> ??☆ ????$(‘input[id = planStartTime_add]‘).attr("disabled", true);☆ ????<div id="scan_div" class="editTraningClass content" >xxx</div> ???var $div_detail = $(‘div#scan_div‘); ???????$div_detail.find(‘input‘).attr(‘readOnly‘, true); ???$div_detail.find(‘textarea‘).attr(‘readOnly‘, true); ???$div_detail.find("input[id=planStartTime_scan]")attr(‘disabled‘, true); ????
Jquery中.attr与.prop的区别
原文地址:https://www.cnblogs.com/hahajava/p/9044411.html