I am trying to dynamically change the width of an element in :after. But it is not reflecting. Can someone please help!
$(function(){
var a=20;
$(".progress:after").width(a+"%");
// This is not showing 20%. Still shows 50% which was coded in CSS
});
.progress {
width:200px;
height:50px;
border:1px solid black;
position:relative;
}
.progress:after {
content:'\A';
position:absolute;
background:black;
top:0; bottom:0;
left:0;
width:50%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="progress"></div>
Here is the Link to JSFidle