I would like to toggle the text when the div is clicked but I can't make it work. I can make it change once using this
$(document).ready(function() {
$(".select_button").on("click", function() {
$(this).find('.selected').text('Image Selected');
});
});
But I'm trying to get it to toggle
This is the HTML
<div class="select_button">
<label>
<input type="checkbox" name="include_standard" class="include_standard"
value="<? echo $row['newest_image']; ?>">
<span class="selected">Use Image</span>
</label>
</div>
And this is the JQuery
$(document).ready(function() {
$(".select_button").on("click", function() {
$(this).find('.selected').text(text() == 'Use Image' ? 'Selected': 'Use Image');
});
});
It doesn't throw any errors or doing anything.