get width of element with jqueryset width to height by css jquery
To get the width of an element with jQuery, you can use the .width() method:
var elementWidth = $('#myElement').width();
To set the width to the height of the same element using CSS and jQuery, you can use the .height() method along with the .css() method:
var elementHeight = $('#myElement').height();
$('#myElement').css('width', elementHeight);
This will set the width of the element to be the same as its height.
原文地址: https://www.cveoy.top/t/topic/b7TZ 著作权归作者所有。请勿转载和采集!