JQuery切换按钮

时间:2016-02-22 08:51:20

标签: javascript jquery html

我需要JQuery的帮助,我是编程的初学者。     我需要的是,当我点击一个特定的按钮时,会出现描述,但是当我点击一个按钮时它们会立刻出现。请帮忙。谢谢:)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").toggle(500);
  });
});
</script>


<body>


<?php
  include ("includes/connect.php"); 

  $query ="select * from jobshiring ";
  $run = mysql_query($query);

  while ($row=mysql_fetch_array ($run)) {
    $job_ID = $row['job_ID'];
    $job = $row['job'];
    $description = $row['description']; 
 ?> 

<table >
  <tr align="left"> 
    <td > <button> <?php echo $job;             ?>  </button></td>
    <td > <p>      <?php echo $description;     ?> </p>      </td>
  </tr>
  <?php } ?>    
</table>

1 个答案:

答案 0 :(得分:4)

将按钮点击处理程序更改为

class class1():
    ... init etc...
    def function1(inputs):
        do something
        return(output1)

    def function2(inputs):
        returnvals = class1.function1(some_inputs)
        do something else
        return(output2)

您需要遍历下一栏中的段落