此問題因瀏覽器版本跟使用者電腦而異,所以同一個畫面同一個欄位有的人會遇到有的人不會
<input dont-fill type="tel" class="form-control" />
.directive('dontFill', function () {
return {
restrict: 'A',
link: function link(scope, el, attrs) {
// password fields need one of the same type above it (firefox)
var type = el.attr('type') || 'text';
// chrome tries to act smart by guessing on the name.. so replicate a shadow name
var name = el.attr('name') || '';
var shadowName = name + '_shadow';
// trick the browsers to fill this innocent silhouette
var shadowEl = angular.element('<input type="' + type + '" name="' + shadowName + '" style="display: none">');
// insert before
el.parent()[0].insertBefore(shadowEl[0], el[0]);
}
};
})
沒有留言:
張貼留言