jquery preventdefault action not working as expected
<p>I've been playing with jquery and had a problem with a code I wrote in that anything with </p>

<pre><code>&lt;a href"#" 
</code></pre>

<p>was adding localhost# to the end of every URL when the links where clicked it turned out that I needed to add event.preventDefault(); to my code.</p>

<p>Adding event.preventDefault(); to my code fixed the issue of localhost# being added to the end of every URL for a bit. I have since made other changes to the jquery code to get a few other things working and now the localhost# has returned everytime I click the 'hide' link it redirects me to another page 'localhost#' instead of overriding the default action.</p>

<pre><code>   $(document).ready(function(){
       $("#show_rpack").click(function(event) { 
           event.preventDefault();

           var theDiv = $("#rpacks_admin");
           if (theDiv.is(":visible")) { 
               theDiv.hide(50);
           }
           else { 
               theDiv.show(50);
           }
       });
   });
</code></pre>

<p>and the html code</p>

<pre><code>    &lt;div id="rpacks_admin" style="display: none;"&gt;
        &lt;h5&gt;hello&lt;/h5&gt;
    &lt;/div&gt;
&lt;a href='#' id='show_rpack'&gt;hide&lt;/a&gt;"
</code></pre>
