Looking to change the content of a button upon clicking it - specifically transitioning it to a "block" state where it becomes unclickable, all while displaying a Glyphicon icon.
Here's what I want to include:
<span class="glyphicon glyphicon-saved" aria-hidden="true"></span>
Along with the text "Downloaded" - my goal is to replace the original text and Glyphicon, and I stumbled upon this jQuery snippet that alters the text on click.
<script>
$(document).ready(function(){
$('#download-btn').click(function() {
$("#download-btn").text('Downloaded');
})
});
</script>
However, I encountered an issue while trying to include HTML code, as it was displayed as plain text.
Lastly, I aim to apply the style btn-block
to the button.
Here is the button before being clicked:
<button id="download-btn" type="button" class="center btn btn-primary">
<span class="glyphicon glyphicon-save" aria-hidden="true"></span> Download
</button>
After clicking, the jQuery snippet mentioned above changes the text to "Downloaded", yet I'm struggling to understand how to add both style and code to a tag.