Yes, $(fn) is jQuery for "run fn when the page is ready". Putting event
binding in here ensures that you don't try binding events to elements that
don't exist yet.

You can bind element events with either $(selectstring).eventname(fn) or
$(selectstring).bind("eventname",fn).

One thing to think about is whether you want to be able to hide the form if
they click again. In that case you can use the artificial 'toggle' event:
$('a').toggle(function(){
  jqForm.show();
},function(){
  jqForm.hide();
});
jQuery will automatically alternate between the functions on each click.

Blair

On 1/11/07, unohoo <[EMAIL PROTECTED]> wrote:


So this means the function:

$(function() {

     var jqForm = $('#your-form-id');
     jqForm.hide();
     $('a').click(function() {
         jqForm.show();
     });

});

will be called when the document / page is ready. And then I also need to
have a different function in there for the radio selector -- where would
it
go -- in the main $(function) ?

Sorry abt the newbie questions.
thanks,
pranav.

Klaus Hartl wrote:
>
> unohoo schrieb:
>> Hi,
>>
>> I'm a convert from prototype and so apologies if this may come out as a
>> dummy question.
>>
>> What I intend to do is following:
>>
>> I have a link (  element). On click, it displays a form which has 2
radio
>> elements. By default, this form is not visible. only when the   element
>> is
>> clicked, the form becomes visible. Then, on form visible, user can
select
>> any radio button and then form is processed.
>>
>>
>>  In prototype, I used the hide, visible ,block elements for
accomplishing
>> the above. By default, the form had a :hide associated to it.
>>
>> How do I accomplish the same in Jquery ?
>
>
> $(function() {
>
>      var jqForm = $('#your-form-id');
>      jqForm.hide();
>      $('a').click(function() {
>          jqForm.show();
>      });
>
> });
>
>
> -- Klaus
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
>

--
View this message in context:
http://www.nabble.com/%3Ca%3E-on-click-show-form-tf2953602.html#a8261595
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to