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
Post a Comment