JQUERY TABS NOT WORKING WITHIN THE CYCLE FOR

Pravesh Singh

Total Post:101

Points:709
Posted by  Pravesh Singh
JQuery 
 1260  View(s)
Ratings:
Rate this:
Hi developers!

This is my code: -script:

<script>

       $(function() {

       $( "#tabs" ).tabs();

       });

     </script>

-HTML:

for($i=0;$i<$num_panels;$i++)

    {

        $data0=pg_fetch_row($result0);

        $name=$data0[5];

        $label_name=$data0[6];

        $script_link=$data0[7];

        echo "<div id=\"tabs\" width=\"590px\">";

        echo "<ul><li>";

        echo "<a href=\"#tabs-\".$i> $name </a>";

        echo "</li>";

        echo "</ul>";

        echo "<div id=\"tabs-\".$i>

            <p>hnckbrg</p>

            </div> ";      

    }      

  echo "</div>";

this code is only generating the first tab. I do not know how to solve. can you help me?

  1. Vijay Shukla

    Post:100

    Points:700
    Re: Jquery Tabs not working within the cycle for

    I notice a problem with the generated HTML:

    echo "<a href=\"#tabs-\".$i> $name </a>";

    echo "</li>";

    echo "</ul>";

    echo "<div id=\"tabs-\".$i>

    Would result in the following HTML:

    <a href="tabs-"1>Name</a>

    </li>

    </ul>

    <div id="tabs-"1>...

    Notice how the id's are "tabs-"[Number] as opposed to "tabs-[Number]". Same problem with the href. This might be it or at least part of it.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!