Toy Posted March 13, 2012 Share Posted March 13, 2012 hello, im kind of stuck because I can't think clearly,using jquery 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 Quote Link to comment https://forums.phpfreaks.com/topic/258792-checkbox-filtering/ Share on other sites More sharing options...
AyKay47 Posted March 13, 2012 Share Posted March 13, 2012 That explanation makes no sense to me at all. Maybe the relevant code will. Quote Link to comment https://forums.phpfreaks.com/topic/258792-checkbox-filtering/#findComment-1326667 Share on other sites More sharing options...
Toy Posted March 13, 2012 Author Share Posted March 13, 2012 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) Quote Link to comment https://forums.phpfreaks.com/topic/258792-checkbox-filtering/#findComment-1326669 Share on other sites More sharing options...
AyKay47 Posted March 13, 2012 Share Posted March 13, 2012 1. Var name is not defined in the functions scope and therefore cannot be used. 2. The code you posted has nothing to do with checkboxes. Quote Link to comment https://forums.phpfreaks.com/topic/258792-checkbox-filtering/#findComment-1326763 Share on other sites More sharing options...
Adam Posted March 13, 2012 Share Posted March 13, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/258792-checkbox-filtering/#findComment-1326794 Share on other sites More sharing options...
Toy Posted March 13, 2012 Author Share Posted March 13, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/258792-checkbox-filtering/#findComment-1326881 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.