Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function($){
- $(document).ready(function(){
- var bz_searchManager = {
- _searchValues : [],
- run: function() {
- var self = this;
- $('.select_xxx').on('change',function(){
- var attrName = $(this).attr('data-attribute-name'); // gender
- var attrValue = $(this).val(); // Male
- self._searchValues[attrName] = attrValue;
- });
- },
- sortTheDogs: function() {
- var self = this;
- $('.dog-post').each(function(){
- var isValid = true;
- for( var i in self._searchValues ) {
- var attributeName = i;
- var attributeValue = self._searchValues[ i ];
- console.log( attributeName, attributeValue);
- // js "equal" for comparing 2 strings
- // dont forget to compare if the self._searchValues[ i ];
- if( $(this).attr('data-' + attributeName ) != attributeValue ) {
- isValid = false;
- }
- }
- if( isValid == true ) {
- // show the dog
- } else {
- // hide the dog
- }
- });
- },
- };
- bz_searchManager.run();
- });
- })(jQuery);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement