我将一个函数附加到某个表的每个th元素:
$(document).ready(function()
{
$('#table_id thead th').each(function()
{
$(this).disableTextSelect(); // disableTextSelect() is user defined function extending jquery
});
}
如果该表已经加载,则可以正常工作。
为了将它附加到表上,如果将来要加载它,我必须使用.on()。但我不知道如何:-(
$(document).on('which event?!', '#table_id thead th', function()
{
$(this).disableTextSelect();
});
非常感谢你,
幻影
最佳答案
我假设您想绑定事件以单击?
$(document).on('click', '#table_id thead th', function() {
$(this).disableTextSelect();
});
为了将来参考,jQuery文档包含了所有jQuery事件的列表,可以在here中找到。