title: Is it possible to do what Jquery framework does to do on click of this event through javascript
body: <p>Once you run this fiddle .</p>
  
  <p><a href="http://jsfiddle.net/jWaEv/56/" rel="nofollow">http://jsfiddle.net/jWaEv/56/</a></p>
  
  <p>Click on the square box on the right side of the Add Restaurant Text (A Panel is getting displayed and its working fine (panel with id rightpanel))</p>
  
  <p>All this is working fine </p>
  
  <p>The issue is that .</p>
  
  <p>When you click on the Delivery and click on the square box on the right side  (The Panel gets displayed but its not working properly (not getting closed when clicked anywhere on the body or on  the icon ))</p>
  
  <p>Could you please let me know how to fix this ??</p>
  
  <p>To solve the i tried as shown below </p>
  
  <pre><code>$(document).on('click', '#testhrefid', function(event) {
  
      if( $(".ui-panel").hasClass("ui-panel-open") == true ){
  
          $('#rightpanel').panel('close').enhanceWithin();
  }else{
      $('#rightpanel').panel('open').enhanceWithin();
  }
  
  });
  </code></pre>
  
  <p>could you please let me know how to resolve the issue ??</p>