We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27330
    • 884 Posts
    Hi guys,

    I have a jquery bit that suppose to toggle a registration form DIV when clicking the link.

    The toggle works fine but the div is visible by default and I need it hidden unless the link is clicked.
    anyone see why?

    $(function()
    {

    $("#click_here").click(function(event) {
    event.preventDefault();
    $("#RegisterNow").slideToggle();
    });

    $("#RegisterNow a").click(function(event) {
    event.preventDefault();
    $("#RegisterNow").slideUp();
    });
    });
      • 27330
      • 884 Posts
      ok got it. pardon the kb server space wasted.


      $(document).ready(function()
      {
      $(’#RegisterNow’).hide();

      $("#click_here").click(function(event) {
      event.preventDefault();
      $("#RegisterNow").slideToggle();
      });

      });
        • 7231
        • 4,205 Posts
        Another option is to hide the div with CSS so that it’s natural state is hidden.
          [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

          Something is happening here, but you don't know what it is.
          Do you, Mr. Jones? - [bob dylan]
          • 27330
          • 884 Posts
          yeah I think that’s the way I had it on the site I used it before (took the jquery bite w/o checking the css file).