我将“禁用”属性textbox
动态添加到输入字段中jQuery
。但是查看生成的,它在我添加了 'disabled' 属性HTML
的输入字段上不可见。textbox
而且因为它没有被添加到其中,所以我的其他 jQuery 函数永远不会被输入。
这是我的代码:
这发生在文档加载事件中的某个地方:
$('.testGroup :input').prop('disabled', true)
click
当您或hover
禁用输入时,此功能会显示工具提示:
$('input:disabled').after(function (e) {
debugger;
d = $("<div>");
i = $(this);
d.css({
height: i.outerHeight(),
width: i.outerWidth(),
position: "absolute",
})
d.css(i.offset());
d.attr("title", i.attr("title"));
d.tooltip();
return d;
});
我已经使用/尝试过prop()
and attr()
,但没有一个进入我的after()
函数。
根据Paul Rosania的说法,我应该使用prop()
.
还有另一种方法可以做到这一点吗?
编辑:jsFiddle