0

I'm stuck with a problem when using Jquery UI Dialog. I generate a table from php (while loop), with headers like name,email,comments. Comments are set to display:none, and i want to show them,only when i click a button like "View" within the corresponding row. The problem is that jquery will generate multiple dialogs , instead of one.

so, my jquery code looks like (from example):

$.fx.speeds._default = 1000;
 $(function() {
 $( ".dialog" ).dialog({
 autoOpen: false,
 show: "blind",
 hide: "explode"
 });

 $( ".opener" ).click(function() {
 $(".dialog").dialog( "open" );
 return false;
});
});

! Where .dialog is the class i set to to my comments, and opener is the class i set to my button view.

What should i do to receive only one dialog, corresponding to the clicked row ? If i click view from row 2, i want dialog with comments corresponding to dialog 2. Not all of them. Thanks in advance!

1 Answer 1

0

With $(".dialog").dialog( "open" ); you open ALL dialogs with class .dialog. I don't know your HTML, but you should look for the dialog you want to open. So use something like:

$.fx.speeds._default = 1000;
 $(function() {
 $( ".dialog" ).dialog({
 autoOpen: false,
 show: "blind",
 hide: "explode"
 });

 $( ".opener" ).click(function() {
 $(this).parent('.dialog').dialog( "open" );
 return false;
});
});
Sign up to request clarification or add additional context in comments.

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.