Trình giữ chỗ không hoạt động trong IE-9, vì vậy tôi đã sử dụng mã bên dưới để giữ chỗ.Trình giữ chỗ không hoạt động
jQuery(function() {
debugger;
jQuery.support.placeholder = false;
test = document.createElement('input');
if ('placeholder' in test) jQuery.support.placeholder = true;
});
// This adds placeholder support to browsers that wouldn't otherwise support it.
$(function() {
if (!$.support.placeholder) {
var active = document.activeElement;
$(':text').focus(function() {
if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
$(this).val('').removeClass('hasPlaceholder');
}
}).blur(function() {
if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
$(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
}
});
$(':text').blur();
$(active).focus();
$('form:eq(0)').submit(function() {
$(':text.hasPlaceholder').val('');
});
}
});
Khi tôi lấy giá trị của kiểm tra, nó cho thấy null.How tôi có thể nhận được các chi tiết của tất cả các thẻ đầu vào?
nơi sẽ không hỗ trợ trên ít hơn IE 10 –
@Deepu Hình như OP biết rằng, và đang cố gắng thực hiện một workaround ... – Teemu
@Deepu OP của code là một shim để hỗ trợ 'placeholder' ... –