jquery1.10 removes the .live() method and adds a new .on() method to bind events to elements. The specific usage is as follows:
on(events,[selector],[data],fn )
$("#dataTable tbody tr").on ("click", function(event){
alert($(this).text());
});
The above method binds all tr The event is set, but the event cannot be bound to the newly added element.
$("#dataTable tbody").on(" click", "tr", function(event){
alert($(this).text());
});
The above method binds tbody An event is generated, and if the tr in it is a new element, the click event can be triggered uniformly.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn