I have already tried each of the solutions from: How to get the children of the $(this) selector?
I have two buttons, one for Friday and one for Saturday. I want to only show the spinner icon on the button I clicked, not both buttons.
The two code attempts below do not produce any errors. They simply don't work.
(function($) {
$(document).ready(function(){
$(this).on('click', function(){
$(this).children('.hide').toggleClass('.hide');
});
});
})( jQuery );
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" rel="stylesheet"/>
<a href="#" class="waves-effect waves-light btn mb15 w100">
<span class="button-text">Friday </span>
<i class="fa fa-life-ring fa-spin hide"></i>
</a>
<a href="#" class="waves-effect waves-light btn mb15 w100">
<span class="button-text">Saturday</span>
<i class="fa fa-life-ring fa-spin hide"></i>
</a>
(function($) {
$(document).ready(function(){
$(this).on('click', function(){
$('.hide', this).toggleClass('.hide');
});
});
})( jQuery );
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css" rel="stylesheet"/>
<a href="#" class="waves-effect waves-light btn mb15 w100">
<span class="button-text">Friday </span>
<i class="fa fa-life-ring fa-spin hide"></i>
</a>
<a href="#" class="waves-effect waves-light btn mb15 w100">
<span class="button-text">Saturday</span>
<i class="fa fa-life-ring fa-spin hide"></i>
</a>