drsb77336 2015-12-08 17:43
浏览 65
已采纳

动态JQUERY无法正常工作

<?php
include("dbFunctions.php");
$query ="SELECT * FROM medical_category";

$result = mysqli_query($link,$query);
//datebase query
?>
<!doctype html>

<html lang="en">
<head>
<meta charset="utf-8">
<title>Official form</title>
<link rel="stylesheet" type="text/css" href="stylesheets/jquery-ui.css" />
<script language="javascript" type="text/javascript" src="scripts/jquery-    1.10.2.min.js"></script>

<script language="javascript" type="text/javascript" src="scripts/jquery-ui.js"></script>
 //javascript
<script>
$(function() {
$( "#tabs" ).tabs();
});
</script>

// tabs function

</head>
<body>

<div id="tabs">

   <?php while ($arrayResult = mysqli_fetch_array($result)){ ?>

  // fetch the array , is the vertical data affecting the alignment of tabs

    <li><a href="#tabs-<?php echo $arrayResult['Medical_category_id']?> "><? php echo $arrayResult['Medical_categoryName']; ?></a></li>

the php part is working but the tabs based on the id is not aligning well my echo data is currently vertically aligned how to make the tabs work again? the data are also separated by bullets , it is not aligned as a tab suppose to be

  • 写回答

1条回答 默认 最新

  • douyi1197 2015-12-08 18:11
    关注
    <?php
    include("dbFunctions.php");
    $query ="SELECT * FROM medical_category";
    $result = mysqli_query($link,$query);
    ?>
    <html>
    <head>
      <meta charset="utf-8">
      <title>Official form</title>
      <link rel="stylesheet" type="text/css" href="stylesheets/jquery-ui.css" />
      <script src="//code.jquery.com/jquery-1.10.2.js"></script>
      <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
      <script>
      $(function() {
        $('#tabs li>div').appendTo('#tabs');
        $( "#tabs" ).tabs();
      });
      </script>
    </head>
    <body>
    <div id="tabs">
      <ul>
        <?php while ($arrayResult = mysqli_fetch_array($result)){ ?>
        <li><a href="#tabs-<?php echo $arrayResult['Medical_category_id']?>"><?php echo $arrayResult['Medical_categoryName']; ?></a>
        <div id="tabs-<?php echo $arrayResult['Medical_category_id']?>"><p>content of the tab</p></div></li>
        <?php };?>
      </ul>
    </div>
    </body>
    </html>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?