Get inline-style value even if element has the value also set in CSS?

前端 未结 2 1195
小鲜肉
小鲜肉 2021-01-18 23:39

If you have the following element:


and the css is:

span {width:50px!importa         


        
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-18 23:49

    use element.style.width

    sample:

    $(function(){
        alert($("span")[0].style.width);
    });
    

提交回复
热议问题