Eroare in cod jQuery
Scris: Sâm Oct 22, 2011
Buna, am facut si eu un mic script cu functii Jquery, iar, cand l-am lansat, nu imi mergea. Eu unul am cautat prin script si nu am gasit erroarea... Scriptul este acesta:
Poate are cineva ochii mai buni decat mine (100%) si ma poate ajuta... Ms mult
Cod: Selectaţi tot
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
//Hide the div friends and form
$('#friends').hide();
$('#form').hide();
//Show the div friends and form at the click on the div show_friends and show_form
$('#show_friends').click(function(){
$('#friends').slideToggle();
});
//If the div #friends is visible, then rename the div #show_friends with: Hide friends.
if($('#friends').is(':visible')){
$('#show_friends').html('Hide friends');
}
//Show the div form at the click on the div show_form
$('#show_form').click(function(){
$('#form').slideToggle();
});
//If the div #form is visible, then rename the div #show_form with: Hide form
if(#('#form').is(':visible')){
$('#show_form').html('Hide form');
}
//Close the ready document function
});
</script>
</head>
<body>
<div id="form">Aici formul de trimis mesaj privat</div>
<div id="friends">Aici arat prietenii</div>
<div id="show_form">Trimite mesaj privat</div>
<div id="show_friends">Are 10 prieteni</div>
</body>
</html>