|
|
|
ขอ code ของ jquery ในการ disabled all element ทั้งหมดในหน้าเว็บให้ดูได้อย่างเดียวครับ |
|
|
|
|
|
|
|
Code (JavaScript)
<script type="text/javascript">
$(document).ready(function() {
$('#:input').attr('disabled', true);
});
</script>
ลองดูแบบนี้ครับ
|
|
|
|
|
Date :
2012-09-27 21:54:11 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เอาไปประยุกต์ดูครับ
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.checkAll').click(function(){
if($(this).attr('checked')){
$('input:checkbox').attr('checked',true);
}
else{
$('input:checkbox').attr('checked',false);
}
});
$('.DE').click(function(){
if($('input:checkbox').attr('disabled') && $('input:text').attr('disabled')){
$('input:checkbox').removeAttr('disabled');
$('input:text').removeAttr('disabled');
}
else{
$('input:checkbox').attr('disabled','disabled');
$('input:text').attr('disabled','disabled');
}
});
});
</script>
</head>
<body>
<input type="checkbox" class="checkAll" /> <b>Check All/Uncheck All</b></br>
<input type="checkbox" /> Checkbox 1
<input name="" type="text" /></br>
<input type="checkbox" /> Checkbox 2
<input name="" type="text" /></br>
<input type="checkbox" /> Checkbox 3
<input name="" type="text" />
</br>
<input name="button" type="button" value="Disable/Enable" class="DE"/>
</body>
</html>
|
|
|
|
|
Date :
2012-09-27 22:43:31 |
By :
Krungsri |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|