Home > DeveloperSection > Forums > Jquery Tabs not working within the cycle for
Pravesh Singh
Pravesh Singh

Total Post:101

Points:709
Posted on    August-16-2013 6:44 AM

 JQuery JQuery 
Ratings:


 1 Reply(s)
 929  View(s)
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?



Vijay Shukla

Total Post:100

Points:700
Posted on    August-19-2013 3:24 AM

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.


Don't want to miss updates? Please click the below button!

Follow MindStick