Auto.js issues

Permalink
So I was trying my hand at modifying the form block, and I have it working pretty well. I wanted to have a field that only displayed if another field was checked (be warned, javascript is not my friend) and I found my answer to it athttp://iamzed.com/2006/12/14/using-jquery-to-show-hide-form-element...
initially I just put the code in add and edit.php, like
<script type="text/javascript">
    $(document).ready(function(){
       $("#question-extra-info").css("display","none");
       $("#question-extra-info-on").click(function(){
        if ($("#question-extra-info-on").is(":checked"))
        {
            $("#question-extra-info").show("fast");
        }
        else
        {      
            $("#question-extra-info").hide("fast");
        }
      });
    });
     </script>
and it works great- when question-extra-info-on is checked, the extra field shows. however, since I was thinking about submitting it to the marketplace, I realized that I should put the code in auto.js instead, and thats where I started getting troubles. I can't get the code to load in add or edit mode, the block is just displayed no matter whether the box is checked or not. I have looked at some other examples of this, like the page list, but since I'm not to good with javascript, I can't seem to get it to work no matter what. I just want it to be that when a checkbox is selected more options are shown. any ideas?
thanks

View Replies: View Best Answer
tinywings replied on at Permalink Reply
Bump?
Mnkras replied on at Permalink Best Answer Reply
Mnkras
just put

$(document).ready(function(){
       $("#question-extra-info").css("display","none");
       $("#question-extra-info-on").click(function(){
        if ($("#question-extra-info-on").is(":checked"))
        {
            $("#question-extra-info").show("fast");
        }
        else
        {      
            $("#question-extra-info").hide("fast");
        }
      });
    });


in it,