Permalink
Browse files

Setting input.type= doesn't work in oldIE. Hide the input using css i…

…nstead.
  • Loading branch information...
1 parent 7b028cb commit 24e7f135419f1e340765ccfa552d4d426d7352c3 @ghiculescu ghiculescu committed Jun 6, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 jquery.colorPicker.js
@@ -146,7 +146,11 @@
// Hide the original input.
if (element[0].tagName.toLowerCase() === 'input') {
- element.each(function () { this.type = 'hidden' });
+ try {
+ element.attr('type', 'hidden')
+ } catch(err) { // oldIE doesn't allow changing of input.type
+ element.css('visibility', 'hidden').css('position', 'absolute')
+ }
} else {
element.hide();
}

0 comments on commit 24e7f13

Please sign in to comment.