removeProp():要素のプロパティ(property)を削除する
2016/04/19
要素のプロパティ(property)を削除するの書式
$("要素名").removeProp("プロパティ名");
要素のプロパティ(property)を削除する場合は、
$("要素名").removeProp("プロパティ名");を記述します。
removePropメソッドの第1引数にプロパティ名を代入となります。
具体例(要素のプロパティ(property)を削除のサンプルコード)
サンプルでは以下の事をしてます。
1.removePropメソッドを使って、disabledプロパティの削除。
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
<!--
body {background-color: #ffffff;}
-->
</style>
<script src="../../js/jquery-1.12.2.min.js"></script>
<script>
$(function(){
$("input:checkbox").removeProp("disabled");
var result = $("input:checkbox").prop("disabled");
$("#resultDiv").text('チェックボックスのにdisabledは' + result);
});
</script>
</head>
<body>
<input type="checkbox" name="testchk" value="1" disabled="disabled" ><br>
<div id = "resultDiv"></div>
</body>
</html>
要素のプロパティ(property)を削除するのサンプルコードの結果
