我有HTML作为:
<input id="SLOCriteriaOtherText" name="SLOCriteriaOtherText" style="width: 100%;" type="text" data-role="autocomplete" placeholder="Enter name for 'other' metric..." class="k-input" autocomplete="off" role="textbox" aria-haspopup="true" aria-disabled="false" aria-readonly="false" aria-owns="SLOCriteriaOtherText_listbox" aria-autocomplete="list">我只是想验证一下它是否为空白文本框检查。
上面的文本框有占位符如下:
Enter name for 'other' metric...我已经对空白文本框进行了验证,检查如下:
if ($("#SLOCriteriaOtherText").val() == "") {
alertMessageText += "Please enter Other criteria text. \n";
}它在Chrome上运行得很好。
但在上不起作用。
当我从internet警告SLOCriteriaOtherText的值时,它会显示占位符的值。也就是。
Enter name for 'other' metric...此验证在Internet上失败,并在crome上工作。
请帮帮我。
如何在internet上不使用占位符来获取SLOCriteriaOtherText的值(版本9)
发布于 2014-09-22 12:28:53
尝试使用这个jQuery IE占位符库。IE对占位符很讨厌:)
http://www.moreonfew.com/how-to-make-placeholder-work-in-ie/
示例使用-
包括JS -
<!-- Include the jQuery file -->
<script src="jquery.min.js" type="text/javascript"></script>
<!-- Include the jquery.placeholder.js file -->
<script src="jquery.placeholder.js" type="text/javascript"></script>定义DOM
<input type="text" name="emailAddress" placeholder="Enter your email address" />
<textarea name="about" placeholder="Tell us about yourself" />占位符:)
<!-- Apply the placeholder functionality to elements
using appropriate jquery selectors -->
<script type="text/javascript">
$('input[type=text], textarea').placeholder();
</script>https://stackoverflow.com/questions/25974079
复制相似问题