我在IE9上将HTML5属性“ placeholder”用于placeholder.js。

我的问题是,页面最初加载时,输入字段仍未显示任何占位符。一旦我单击并在输入字段内聚焦并重新聚焦出去,它就会起作用。我无法理解可能导致此问题的原因。

我在页脚中加载了placeholder.js

<script src="/bower_components/angular/angular.js"></script>
<script src="/bower_components/angular-route/angular-route.js"></script>
<!--Third Party Dependencies-->
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/js/libs/harvey.js"></script>
<script src="/js/libs/screen.js"></script>
<script src="/js/libs/placeholder.min.js"></script>
<!--Application Scripts-->
<script src="/js/app.js"></script>
<script src="/js/controllers/mainCtrl.js"></script>
<script src="/js/controllers/couponCtrl.js"></script>
<script src="/js/services/mobileDetection.js"></script>
<script src="/js/main.js"></script>


这是输入字段:

<input type="email" class="form-control email-address-input" name="userEmail" ng-model="email.text" placeholder="ENTER EMAIL ADDRESS" ng-class="{ 'error': emailForm.userEmail.$error.email }" required>


如果您有任何问题,请随时提出任何反馈。
谢谢,周杰伦。

最佳答案

对于Internet Explorer 9,似乎将角度模型ng-model="email.text"插入到输入字段中。

$scope.toggleEmailClick = function(){
    $scope.coupon.showEmailForm = !$scope.coupon.showEmailForm;
    $scope.coupon.emailSent = false;
    $scope.email.text = "";
}

关于javascript - IE9 Placeholder.js错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/31812281/

10-13 00:44