Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-03-2011, 08:14 AM   PM User | #1
maxhud
Regular Coder

 
Join Date: Mar 2011
Posts: 147
Thanks: 35
Thanked 0 Times in 0 Posts
maxhud has a little shameless behaviour in the past
weird javascript problem: no errors thrown & no feedback

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:

Code:
<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">
maxhud is offline   Reply With Quote
Old 07-03-2011, 08:51 AM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
This is a simple $(document).ready() problem ... has been mentioned many times here (nearly every day!)

Code:
$(document).ready(function() {
   // your code goes here
});
devnull69 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:02 AM.


Advertisement
Log in to turn off these ads.