jquery - Using javascript to remove link formatting on click -


i'm using javascript (and jquery) move between 3 box descriptions.

javascript

<script type="text/javascript">     $(document).ready(function() {         $('#foo-box').show();         $('#bar-box').hide();         $('#bob-box').hide();        $('#bar-link').click(function() {         $('#foo-box').hide();         $('#bob-box').hide();         $('#bar-box').show();          return false;       });     }); </script> 

html

<div id="stuff">     <a href="" id="foo-link">foo</a>     <a href="" id="bar-link">bar</a>     <a href="" id="bob-link">bob</a>     <div id="foo-box">hello</div>     <div id="bar-box">world</div>     <div id="bob-box">!!!</div> </div> 

but after clicking on link want normal text. can't seem figure out good, elegant way of doing in javascript (i've found few ways may work, hacks).

am being thick?

maybe jquery replacewith() help?

  $('#bar-link').click(function() {     ...      $(this).replacewith($(this).text());      return false;   }); 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -