Are you using the onclick event inside your html?  <input type="radio"
onclick="...

if so, you might want to consider using jQuery to bind the onclick events.
Check out www.jquery.com/api or http://www.visualjquery.com and find
"click".
It will make your html much cleaner and your code easier to follow.

Additionally, that line you took out about the document ready.  You still
want to use that to surround your jQuery code.  It's useful when you want to
bind a click function (like above) because it forces the browser to wait
until the dom tree is ready.  Otherwise it will fail to bind the click.

Glen

On 10/19/07, Gurevich, Gerry (NIH/NIEHS) [C] <[EMAIL PROTECTED]>
wrote:
>
>  Thanks to Jim Priest, I think I already have an answer.  Looks like the
> code should be.
>
> function checkReviewers(){
>
>       if (somecondition)
>
>             {
>
>                   alert('reviewers off...do some stuff here');
>
>                   $('.classname').hide();
>
>       }
>
>
>
>
>
>
>
> I would still welcome any comments if there is something that's missing
> here.  But it looks good for now.
>
>
>
> ------------------------------------
> Gerry Gurevich
> Application Development
> NIEHS ITSS Contractor
> Lockheed Martin Information Technology
> 919-361-5444 ext 311
>   ------------------------------
>
> *From:* Gurevich, Gerry (NIH/NIEHS) [C]
> *Sent:* Friday, October 19, 2007 11:24 AM
> *To:* jquery-en@googlegroups.com
> *Subject:* [jQuery] Calling hide/show methods from existing JavaScript
> function
>
>
>
> I have a javascript function that needs to do a variety of things and then
> it also needs to hide a section.
>
>
>
> Here is my function.  It is called from a radio button on click event.
>  Can anyone help me correct this syntax so I hide the code inside
>
> <div class="classname">
>
> Hide me
>
> </div>
>
>
>
>
>
> function checkReviewers(){
>
>       if (somecondition)
>
>             {
>
>                   alert('reviewers off...do some stuff here');
>
>                   $(document).ready(function(){
>
>                         $('.classname').hide();
>
>                   });
>
>             }
>
>       }
>
>
>
>
>
>
>
> ------------------------------------
> Gerry Gurevich
> Application Development
> NIEHS ITSS Contractor
> Lockheed Martin Information Technology
> 919-361-5444 ext 311
>
>
>

Reply via email to