Jump to content

Remove class from current div


fxuser

Recommended Posts

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.