How to use the live jQuery api?
I found this jquery plugin which does exactly what I need, but I want to use it on table rows which are in an update panel, so I was hoping to use the live() jquery api to somehow keep the jquery intact across the update panel requests. Is this possible?
jQuery.fn.linker = function(selector) {
$(this).each(function() {
var href = $(selector, this).attr('href');
if (href) {
var link = $('<a href="' + $(selector, this).attr('href') + '"></a>').css({
'text-decoration': 'none',
'display': 'block',
'padding': '0px',
'color': $(this).css('color')
})
$(this).children()
.css('padding', '0')
.wrapInner(link);
}
});
开发者_运维问答};
You could use the Live Query plugin to listen for <tr>
element creation and then apply this functionality.
$("tr").livequery(function() {
$(this).linker();
});
If I understand that plugin and your desired result correctly.
精彩评论