i am begginer to jquery and have a simple problem..
I want to make list of posts from database..When i hover on heading its show hidden text..
Same like example on freelancers.com
This is my code..
<html>
<head>
<link rel="stylesheet" type="text/css" href="index.css" />
<script src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("tr").mouseover(function(){
$(".neparan").show();
});
$(".neparan").mouseleave(function(){
$(".neparan").hide();
});
});
</script>
</head>
<body>
<table border="1">
<?php
$host = "localhost";
$user = "root";
$lozinka = "";
$baza = "jquery";
mysql_connect($host, $user, $lozinka);
mysql_select_db($baza);
$upit = mysql_query("SELECT * FROM tekst");
while ($red = mysql_fetch_array($upit)) { ?>
<tr class="naslov">
<td>
<?php echo $red["naslov"]; ?>
</td>
</tr>
<tr class="neparan">
<td>
<?php echo $red["tekst"]; ?>
</td>
<td>
<?php echo $red["naslov"]; ?>
</tr>
<?php echo "</br>";
} ?>
</tr>
</table>
</body>
</html>
And css file..
.neparan {display:none;}
.naslov {color:red;}
Problem is that when I hover on tr all td is showing …
Use of find() method will very likely help you get a better understanding of context with regard to searching for elements
http://api.jquery.com/find/