...

View Full Version : weird javascript problem: no errors thrown & no feedback



maxhud
07-03-2011, 09:14 AM
For some reason i cant get this bit of code to work. You can ignore the php and html if its getting in your way. Thanks:


<div id="pl">
<?
if($edit == true){
?>
<script type="text/javascript">
$("#add_playlist_form").css({display:"none"});
$("#add_playlist").click(function(){
alert($("#add_playlist").html());
if($("#add_playlist").html() == "Add a Playlist >>"){
$("#add_playlist").html("Hide <<");
$("#add_playlist_form").css({display:"block"});
}
else{
$("#add_playlist").html("Add a Playlist >>");
$("#add_playlist_form").css({display:"none"});
}
});
</script>
<a href="#" id="add_playlist">Add a Playlist >></a>
<form id="add_playlist_form" method="POST" action=" ">
<input type="text" name="pl_name" class="add_playlist"/>
<textarea name="pl_dsec" maxlength="200"></textarea>
<input type="submit" name="submit_playlist" value="Add Playlist" class="submit_playlist"/>
</form>
<?
}
?>
<ul class="vList">

devnull69
07-03-2011, 09:51 AM
This is a simple $(document).ready() problem ... has been mentioned many times here (nearly every day!)



$(document).ready(function() {
// your code goes here
});



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum