Skip to content

Commit

Permalink
Fix HTML5 validation
Browse files Browse the repository at this point in the history
This fixes HTML5 validation popups in browsers.
Instead of hiding the <select>, move it under the container.
  • Loading branch information
mcuelenaere committed Aug 8, 2012
1 parent 4d3f8b6 commit 4c6f9e5
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion select2.js
Expand Up @@ -492,7 +492,6 @@
// swap container for the element
this.opts.element
.data("select2", this)
.hide()
.before(this.container);
this.container.data("select2", this);

Expand All @@ -512,6 +511,19 @@
this.initContainer();
this.initContainerWidth();

// position element where the container is
this.opts.element
.css({
position: "absolute",
"z-index": 0,
top: this.container.offset().top,
left: this.container.offset().left,
width: this.container.width(),
height: this.container.height()
});
// make sure the container is above the element
this.container.css("z-index", 1);

installFilteredMouseMove(this.results);
this.dropdown.delegate(resultsSelector, "mousemove-filtered", this.bind(this.highlightUnderEvent));

Expand Down

0 comments on commit 4c6f9e5

Please sign in to comment.