当我选择一个元素时,这对我来说很奇怪id
;jquery 代码不起作用,但是当我选择它时,classname
它工作得很好!
这段代码:
<input name='daneshjou_number' class='daneshjou_number' type='text' >
此代码有效:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".is_daneshjou").change(function(){
//alert("The text has been changed.");
$(".daneshjou_number").prop('readonly', true);
});
});
</script>
但这段代码不起作用:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".is_daneshjou").change(function(){
//alert("The text has been changed.");
$("#daneshjou_number").prop('readonly', true);
});
});
</script>