-1

I hear from the comments that toggle does not fit here, so I removed it. The code below works...but is there a better way to do this...my Jquery is limited. Thank you.

$(document).ready(function(){
$('div.botColorBoxBtn1').click(function() {
        $("div.botColorBox").css({ 'height':'90px'});
        $('div.botColorBoxBtn1').hide();
        $('div.botColorBoxBtn2').show();return false;
});
});

$(document).ready(function(){
$('div.botColorBoxBtn2').click(function() {
        $("div.botColorBox").css({ 'height':'11px'});
        $('div.botColorBoxBtn2').hide();
        $('div.botColorBoxBtn1').show();return false;
});
});
Brett
  • 21
  • 3
  • 2
    [what do you expect `toggle` to do?](http://api.jquery.com/toggle/) – zzzzBov Feb 28 '13 at 20:22
  • 1
    Are you using jQuery 1.9 or higher? If so, the [toggle()](http://api.jquery.com/toggle-event/) you're looking for does not exist anymore. – Frédéric Hamidi Feb 28 '13 at 20:22
  • 1
    @FrédéricHamidi, I thought so too, but this doesn't implemention for the toggle-event doesn't make sense. – gdoron Feb 28 '13 at 20:24
  • @gdoron, you're right, only one argument is passed. This looks like plain misuse of the method. – Frédéric Hamidi Feb 28 '13 at 20:26
  • Sounds like toggle should not be used here I gather. I took it out and the button click expands the div below...but now how to click the button again and close it? The link posted above did not clear it up for me. – Brett Feb 28 '13 at 20:38

1 Answers1

3

That's the intended result, as .toggle() will show/hide the matched element.

jrummell
  • 42,637
  • 17
  • 112
  • 171