In your code example, you, for example:
$('#info').prepend('#option1');
What you are instructing here is adding the text string '# option1' to the ID information item.
What you intend to do is add the contents of option1 identifier to the identity element. Instead, you can do something like this:
$('#info').prepend($('#option1').html());
Another approach could be (but I don’t know if this is suitable for you), so as not to clone the content (since it costs you to redraw), but instead switches specific elements. For instance:
$('#option1,#option2').hide(); $('#option3').hide();
And one more: use the data attributes on your buttons:
<a href="#" data-text="Box" class="button">Button 1</a> <a href="#" data-text="Another text" class="button">Button 2</a> <div id="info"> </div>
And JS:
$('.button').on('click', function(event) { event.preventDefault(); $('#info').html($(event.currentTarget).attr('data-text')); });
meavo source share