01/10/2018, 08:37

Kiểm tra các giá trị ảnh trong trang web

Em muốn kiểm tra các giá trị ảnh trong trang web có (width < 50px) để báo ảnh lỗi bằng Javascript thì làm như thế nào? Các a giúp em với.

viết 10:52 ngày 01/10/2018

Bạn thử 2 lệnh này:
document.querySelector(‘imgElm-selector’).removeAttr(“width”); //remove user-defined attribute
document.querySelector(‘imgElm-selector’).width; //get real width.

Bài liên quan
0