Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3664034
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:35:55+00:00 2026-05-19T01:35:55+00:00

I am generating an HTML table with PHP (using the codeigniter framework) and I’m

  • 0

I am generating an HTML table with PHP (using the codeigniter framework) and I’m trying to add a link that will open a jquery dialog with some information that is specific to that row. Sort of a ‘More Info’ type link that simply opens the dialog.

When I add the dialog div to that row and encapsulate the required information in it, it breaks the table (cannot have a div in the table).

Plus, it seems I would need to add an unknown amount of jquery dialog functions declared… I’m assuming some sort of a function is needed and the ID of the element that opens the dialog as well as the ID for the dialog would be passed to the function. But, it seems there should be something built into jQuery for something like this.

Am I missing something, and if so does anybody have any tips to get me pointed in the right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:35:55+00:00Added an answer on May 19, 2026 at 1:35 am

    Embed the information as metadata on the row, a la…

    <tr data-foo="additional data here" data-bar="even more data">…</tr>
    

    And in your javascript, a little magic called .live():

    $('#your_table .show_dialog').live('click', function(){
      var data_for_dialog = {
        foo: $(this).closest('tr').attr('data-foo'),
        bar: $(this).closest('tr').attr('data-bar')
      }
    
      show_dialog(data); // your own code to show the dialog
    });
    

    Where you have an <a> tag with the class “show_dialog”. Note that this isn’t very efficient if you have a lot of attributes or any of them contain data that needs to contain newlines. You could improve this by iterating over each attribute defined on that <tr> and automatically including the attributes starting with data-. That’s out of the scope of this question though.

    As far as showing the dialog, something like this would be sufficient:

    function show_dialog(data) {
      var $dialog = $('#dialog');
      for(var attr in data) {
        $dialog.find("." + attr).html(data[attr]);
      }
      $dialog.show();
    }
    
    <div id="dialog">
      <p class="data-foo"></p>
      <p class="data-bar"></p>
    </div>
    

    That’s untested, but should illustrate what’s happening well enough.

    Note: You can define custom attributes in HTML5 so long as they are prefixed with “data-“, hence that showing up everywhere above.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jquery datatables for html table generation. I setup a callback to
Im searching a Template Lib or Template Engine for generating HTML (XML) that runs
I am trying to find the best practice for generating and outputting html which
Although I have experience with SQL and generating HTML reports with PHP, I'm a
I am generating the Html in Excel sheet and entire table is fine and
Edit: I am using domPDF 0.5.1, hosted http://code.google.com/p/dompdf/ I am using HTML table to
I'm generating a PDF from HTML using Pisa. The pisa documentation (section 11.3) says
Is it possible to transpose an html table (without javascript). I m generating a
I'm generating PDFs from HTML (using ABCPdf and C#) and the files are coming
I am generating a correlation table with http://myowelt.blogspot.com/2008/04/beautiful-correlation-tables-in-r.html I am not successful, however, in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.