togglescript used on radio input type

togglescript used on radio input type

Hi all,

I'm using the script below to display and hide a div when a radio button is pressed. However my problem is that when i go to click on the radio button, i have to press it twice for the radio button to appear checked.

The div appears and hides when needed, so no problem there.

  1. $('input').ready(function() {
     // hides the slickbox as soon as the DOM is ready
     // (a little sooner than page load)
      $('#slickbox').hide();
     // shows the slickbox on clicking the noted link
      $('.slick-show').change(function() {
     $('#slickbox').show('slow');
     return false;
      });
     // hides the slickbox on clicking the noted link
      $('.slick-hide').change(function() {
     $('#slickbox').hide('fast');
     return false;
      });
     // toggles the slickbox on clicking the noted link
      $('.slick-toggle').change(function() {
     $('#slickbox').toggle(400);
     return false;
      });
    });


















HTML code
  1. <input type="radio" name="placing_order" value="placing order very poor"  id="placing_order_very_poor" class="slick-show" />Very Poor
  2. <div id="slickbox" class="maincontainer">
    <label for="response_time_comments">Additonal comments</label>
    <textarea name="response_time_comments"  rows="2" cols="90" id="response_time_comments"></textarea></div>




If anyone can point me in the right direction I would be very grateful. Thanks









    • Topic Participants

    • info