Jump to content

checkbox filtering


Toy

Recommended Posts

hello, im kind of stuck because I can't think clearly,using jquery :shrug:

 

right now its like, click a checkbox to limit the submissions to that category, and if a submissions lies within multiple categories you can click several check boxes to further nail down the results,

but at the moment im just doing like, button calls function to hide all instances not under that category, uncheck the button to show them again, works great

 

but if you would say have a submission that lies beyond 3 categories you could press three boxes and you would find it, but if you now would uncheck one box it'd just show all of the submissions not under that category even if they have been filtered before...

it seems like im over complicating it, basicly I just need the thought process for filtering like this

Link to comment
Share on other sites

sorry, I know

 

	function filter(title,status) {
	$('.listdiv').each(function(){
		if($(this).children("img").hasClass(name)) {
		}
		else{
			if(status == 0) {
				$(this).css("display", "none");
			}
			else {
				$(this).css("display", "");
			}
		}
	})
}

 

basicly I want to do it so that it takes regard of what boxes are already limiting when it unchecks(displays the instances)

Link to comment
Share on other sites

I agree, you're not posting a coherent explanation here.

 

1. Var name is not defined in the functions scope and therefore cannot be used.

 

... Though it is possible that name is defined. Variables defined in the global scope in JavaScript are available within global functions. To declare the variable only within the scope of the function, you need to redeclare it with var. So that also means, for future reference, that if you change the value of a global variable within a function without redeclaring it, you will change the global value too.

Link to comment
Share on other sites

sorry for bad explanation and unrelevant code, Imma try to simplify

 

I have a bunch of instances filtered by checkboxes,

an instance can have several "categories" or well, checkboxes... and I just wanna narrow it down using jquery

what I do for every checkbox press is hide the ones who does not fit in to the category,

but if I then would uncheck the box, it wouldnt take in regard what has already been censored out and this is kind of where I dont really know how to think

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.