0
ApplyClickableLinkToClass = function(selectedElements) {
// Go through each of the passed in selections and try to apply a link to them
$.each(selectedElements, function() {
var linkElement = $("a:first:not(.do-not-apply-clickable-link)", $(this));
var link = linkElement.attr("href");
if (!IsNullEmptyOrUndefined(link)) {
$(this).click(function(firstLink) {
var divToLink = firstLink;
return function() {
$(divToLink).unbind('click');
if (divToLink.attr("target") != "_blank") {
window.location = link;
return false;
}
};
} (linkElement));
}
});
}
調用如下:下面的jquery是做什麼的?
ApplyClickableLinkToClass($j(".rc_blueBtn, .rc_whiteBtn:not(.More)"));
所以添加鏈接到div從裏面第一個HREF發現? – StevieB 2012-03-15 18:32:52
不,它只在鏈接不是'IsNullEmptyOrUndefined'的情況下才會爲每個'selectedElements'添加一個事件... – xandercoded 2012-03-15 18:35:40
而且事件只是在新窗口中打開吧? – StevieB 2012-03-15 18:37:28