115
rated 0 times
[
122]
[
7]
/ answers: 1 / hits: 46631
/ 7 Years ago, sat, january 13, 2018, 12:00:00
I am trying to achieve a loading effect for a button, as demonstrated in codepen.
I am using bootstrap 4
(beta 2) Jquery 3.2.1
.
<!DOCTYPE html>
<html lang=en>
<head>
<meta charset=UTF-8>
<title>Group View</title>
<link rel=stylesheet media=all href=../css/bootstrap.css >
<script src=../js/jquery.js></script>
<script src=../js/bootstrap-bundle.js></script>
</head>
<body>
<div>
<button type=button class=btn btn-primary btn-lg>Submit Order</button>
</div>
<script>
$(document).ready(function() {
$('button').data('loading-text', 'loading...');
$('.btn').on('click', function() {
var $this = $(this);
$this.button('loading');
setTimeout(function() {
$this.button('reset');
}, 8000);
});
})
</script>
</body>
</html>
The above code does not display loading... when the button is clicked.
More From » jquery