My progress bar is built with Bootstrap and here is the HTML code:
$(".progress-bar").animate({
width: $(this).data('width') + '%'
}, 2500);
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="alert alert-success">
<div class="skill-name">ON PROGRESS 357/487</div>
<div class="progress">
<div class="progress-bar progress-bar-primary" role="progressbar" data-width="70">
</div>
</div>
</div>
Why isn't the jQuery code above working when I use $(this).data('width') + '%'?
But it works if I use
$(".progress-bar").data('width') + '%'?
Thank you for your help.
Edit
If I use
$(".progress-bar").data('width') + '%'? It will change all <code>.progress-bar
.