Create divs dynamically

5

Sirs,

I'm working with tabs in Jquery. I have a page called server_server.php where I insert it into the database of as many servers as I want. I need that after clicking the next button the amount of page flaps is the same as the amount of records that were inserted on the previous page. This I even managed to do with the code below:

<div id="tabs">
    <ul>
        <?php
            do {  
        ?>
            <li><a href="#tabs-<?php echo $row_menu_servidor['host_servidor']?>"><?php echo $row_menu_servidor['host_servidor']?></a></li>
        <?php
            } while ($row_menu_servidor = mysql_fetch_assoc($menu_servidor));
            $rows = mysql_num_rows($menu_servidor);
                if($rows > 0) {
                    mysql_data_seek($menu_servidor, 0);
                    $row_menu_servidor = mysql_fetch_assoc($menu_servidor);
                            }               
        ?>          
    </ul>

My problem now is that I need the content of this DIV or that TAB / ABA to be dynamic, too. From what I'm imagining, I need to declare that for every

<li><a href="#tabs-<?php echo $row_menu_servidor['host_servidor']?>"><?php echo $row_menu_servidor['host_servidor']?></a></li>' a página inclua uma DIV com o conteúdo '<div id="tabs-ndcingmgm001">
            <div id="id_solic"><div style="position: absolute; margin-left:10px; margin-top:-10px; width:100px; height: 10;"><br/>
                <h4>ID Solicitação<br>
                <form name="form1" method="post" action="">
                    <input name="id_solic" id="id_solic" type="text" value="<?php echo $_POST['id_solic'];?>" size="5" readonly="readonly">
                    <br><br>
                </form>
            </div>
            </div>
        </div>

I believe that I have to make the ID of this DIV content to be dynamic, according to the amount of query records passed above.

I hope I have been able to explain it clearly.

    
asked by anonymous 23.02.2016 / 18:11

1 answer

0

The answer to your question (if I understand you) is YES , the id needs to be dynamic.

For each tab you want to have, you should create a div with a id and point that same id in the href of the link within li conform example below:

<div id="tabs">
  <ul>
    <li><a href="#tabs-1">Primeira Aba</a></li>
    <li><a href="#tabs-2">Segunda Aba</a></li>
    <li><a href="#tabs-3">Terceira Aba</a></li>
  </ul>
  <div id="tabs-1">
    bla bla bla 1
  </div>
  <div id="tabs-2">
    bla bla bla 2
  </div>
  <div id="tabs-3">
    bla bla bla 3
  </div>
</div>

More examples in the jquery ui site

    
23.02.2016 / 19:11