fxuser Posted January 25, 2011 Share Posted January 25, 2011 Hello, so i have some links and a javascript function which calls a file and display it on a div... the thing is that i have added a line of code which adds a background color on the link i have clicked and what i want to do is remove the class from the current link and continue to the next one and add the new class.. here is my code at the moment: function get_msg_wnd(pos,file,cont) { $(cont).css('background-color','#CCFF99'); $(pos).html('<img alt="loading" src="ajax-loader.gif" />'); setTimeout(get_msg_inbox_f,300,pos,file); $(pos).show(); } function get_msg_inbox_f(pos,file) { $('#msg_content').load(file); $(pos).hide(); } this is the html of one of the links i click: <div id='msg_inbx'> <div id='content_msg_inbx'> <a class='msgs_class' onclick="get_msg_wnd('#inbx_loader','ttt.php','#msg_inbx');">Inbox</a> <div id='inbx_loader'></div> </div> </div> and finally the div that i show the stuff i load: <div id='msg_content'> </div> Thanks! Link to comment https://forums.phpfreaks.com/topic/225641-remove-class-from-current-div/ Share on other sites More sharing options...
requinix Posted January 25, 2011 Share Posted January 25, 2011 http://api.jquery.com/addClass http://api.jquery.com/removeClass If the problem is the "continue to the next one", it'd help to be more specific. Like what "the next one" is. Link to comment https://forums.phpfreaks.com/topic/225641-remove-class-from-current-div/#findComment-1165114 Share on other sites More sharing options...
fxuser Posted January 25, 2011 Author Share Posted January 25, 2011 http://api.jquery.com/addClass http://api.jquery.com/removeClass If the problem is the "continue to the next one", it'd help to be more specific. Like what "the next one" is. it adds the css ( $(cont).css('background-color','#CCFF99'); ) on each button i click on... but what i want is to remove it after i press another button so i can see which is the current button i am on. Link to comment https://forums.phpfreaks.com/topic/225641-remove-class-from-current-div/#findComment-1165137 Share on other sites More sharing options...
fxuser Posted January 25, 2011 Author Share Posted January 25, 2011 solved by adding a select case when the DOM is ready. Link to comment https://forums.phpfreaks.com/topic/225641-remove-class-from-current-div/#findComment-1165184 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.