โค้ด: เลือกทั้งหมด
$('img').attr('width:300px' , 'height:300px');
jQuery เปลี่ยน attribute ต่างๆ
Jquery หาค่าของ id จาก String หรือ จาก tag ต่างเช่น tag img , a href
set input field to readonly using jQuery
https://www.mindphp.com/forums/viewtopic ... 78&t=27038
โดยสามารถ return ค่าโดยอ้างอิง attribute
โค้ด: เลือกทั้งหมด
$(selector).attr(attribute)
โค้ด: เลือกทั้งหมด
$(selector).attr(attribute,value)
โค้ด: เลือกทั้งหมด
$(selector).attr(attribute,function(index,currentvalue))
โค้ด: เลือกทั้งหมด
$(selector).attr({attribute:value, attribute:value,...})
value คือค่า ของ attribute นั้นๆ
function(index,currentvalue) คือ ฟังก์ชั่นที่ return ค่าที่เซ็ต attribute ใน index ส่วน currentvalue รับค่าจากค่า attribute ที่เลือก
โค้ด: เลือกทั้งหมด
$('.draggable').click(function(){
$('#myModal').modal('show');
$('#blockid').val($(this).attr('id'));
});
โค้ด: เลือกทั้งหมด
$('.submita').click(function(){
$('.selectpicker option:selected').attr('disabled',true);
});