What I want to achieve is to be able to click text on screen and then the text I clicked changes to another word.
For example :
if I click 'view as list' I want it to change to 'Thumbnails'
Here is my attempt below:
html code:
<div class="page-intro">
<h2>Artists</h2>
<h2 class="thumb-to-list">View As List</h2>
</div>
css code:
.page-intro {
background: orange;
}
.page-intro h2 {
font-weight: normal;
display: inline-block;
}
.thumb-to-list {
float: right;
}
Here is my attempt at code but it's not working:
$('.thumb-to-list').toggle(function() {
$('.thumb-to-list').text('View As Thumbnails');
}, function() {
$('.thumb-to-list').text('View As List');
});