1

When using jquery-ui-1.8.15.custom.min toggle method, the element next to the target element is always hidden.

Here is the test page: http://jsfiddle.net/dassio/CLrMx/9

I want the div with class name suggestion to toggle between hidden and show when you click the button, but why the red line is always missing?

3
  • you should post a jsfiddle.net with the relevant part of code so that we could help Commented Aug 18, 2011 at 10:05
  • 1
    It will not fix your bug, but to begin, you have to rewrite your HTML code : <div> elements ar not allowed in <ul> if it are not in a <li>, <link> are not closed and missing type='text/javascript' in <scrip> tag. Wrong HTML code can make unpredictable javascript behavior Commented Aug 18, 2011 at 10:15
  • thanks now i get a jsfiddle.net page:jsfiddle.net/dassio/CLrMx/9 and i put the p inside the li element, is that validate? Commented Aug 18, 2011 at 11:07

2 Answers 2

1

This should do the job: http://jsfiddle.net/CLrMx/15/

Your script was accidentally hiding your text. Cleaned it up a bit so it olny does the necessary.

Sign up to request clarification or add additional context in comments.

1 Comment

thanks any way . i found the problem: it is because i add the classname name to the parent div, and when the event bubble up the 'toggle' method is called. i am not allowed to post my answer right now, later i will get more detail description. thanks for your time!
0

I found the problem:

<div id="config" class='name ui-widget-content ui-corner-all'> 
    <button id="details">show details</button> 
</div> 

I add the name class name to the parent div around the button, and when the event bubble up to the parent div, the following code:

$(".name" ).click(function() {
    var clicked = $(this);
    var suggestion = clicked.next();
    suggestion.toggle("fold",200);
    return false;
});

was called and toggle off the <h3> element which is the next element of the parent div.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.