Skip to content

Commit

Permalink
Merge pull request #51 from patrickgalbraith/master
Browse files Browse the repository at this point in the history
Fix "Cannot read property 'class_group' of undefined"
  • Loading branch information
groenroos committed Feb 11, 2015
2 parents 5661725 + f2529ff commit 794ed53
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions jquery.minimalect.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@

var op = this.options,
m = this;

if(op.ajax)
op.live = false;

// create the wrapper
this.wrapper = $('<div class="'+op.class_container+'"></div>');
Expand Down Expand Up @@ -314,9 +317,9 @@
// parse each group separately
this.element.find("optgroup").each(function(){
// create a group element
ulcontent += '<li class="'+this.options.class_group+'">'+$(this).attr("label")+'</li>';
ulcontent += '<li class="'+m.options.class_group+'">'+$(this).attr("label")+'</li>';
// and add its children
ulcontent += this._parseElements( $(this).html() );
ulcontent += m._parseElements( $(this).html() );
});
}
return ulcontent;
Expand Down Expand Up @@ -546,6 +549,9 @@

// if it's disabled, au revoir
if(ch.hasClass(this.options.class_disabled)) return false;

if(!op.live)
this.items = this.wrapper.find('li');

// apply the selected class
if(!this.element.prop("multiple"))
Expand Down

0 comments on commit 794ed53

Please sign in to comment.