inline jquery

inline jquery

I want to write inline jquery at the tag itself  than writing it in header page

here is my html

  1. <fieldset>
  2. <legend> Comments <a class="showHide"  href="#">Show/Hide</a> </legend>
  3. <div>
  4. <div wicket:id="commentsRepeater">
  5. <div wicket:id="comment"/>
  6. </div>
  7. </div>
  8. </fieldset>
  9.  

I wan to write jquery code in onclick attribute of  anchor tag with class showHide, Can we do that ?
here is   my jquery
  1. $(document).ready(function() {
  2. $("a.showHide").live('click',function (event){
  3. var fieldset=$(this).closest("fieldset");
  4. var divContent=fieldset.children("div:first");
  5. divContent.toggle();
  6. if(divContent.is(":visible")){
  7.     fieldset.css('height','auto');
  8. }else{
  9.     fieldset.css('height',null);
  10. }
  11. event.preventDefault(); 
  12. });
  13. });