I need to attach an event to this. I cannot change the function for closing since this is a custom databound control. So I need to navigate the开发者_如何转开发 DOM to find the element. I have isolated the element by doing this:
function getXButton () {
var titlebar = getElementsByClassName('ui-dialog-titlebar');
var titleBarChildren = titlebar[0].childNodes;
var exitAncor = titleBarChildren[1];
var exitSpan = exitAnchor.childNodes;
}
getElementsByClassName is a custom function that navigates the whole page and finds this element. I have the exitAnchor and exitSpan. How the hell do I now apply an onclick function to them?
$('.ui-dialog-titlebar-close').live('click',function(){
});
bind what you need to the onClick of the a tag surrounding that x?
the live binding method ties it to elements that either are or will be on the page that match that class.
精彩评论