특정 클래스의 레이블을 클릭 할 때 나타나는 '도움말'툴팁이 나타나려고합니다. 멀리 클릭하면 사라집니다. 아무것도 나타나지 않습니다. 파이어 버그에서 중단 점을 설정하고 '로딩'툴팁을 볼 수 있습니다. 그러면 아약스가 툴팁을 올바르게 반환 할 때 removeTooltip이 팬텀이라고합니다 (스택 트레이스는 jquery에서 F()라고 말합니다). 그래서 툴팁은 너무 빨리 빠져 나와 결코 보지 못합니다.javascript WTF, 팬텀 함수 호출
HelpText.removeTooltip = function() {
$('#activeHelpTip').remove();
$('body').unbind('click', HelpText.removeTooltip);
}
HelpText.initToolTip = function(clickedElement) {
$('body').click(HelpText.removeTooltip);
$(clickedElement).append('<span id="activeHelpTip" class="helpTip">Loading help...</span>');
}
HelpText.updateTooltip = function(helpString, clickedElement, methodName) {
if (helpString == null) { helpString = "Help text has not been defined for selected field"; }
$('#activeHelpTip').html(helpString);
}
$(document).ready(function() {
$('.helpText').click(function() {
var helpRequested = $(this).html();
var path = window.location.pathname;
var fullPage = path.substring(path.lastIndexOf('/') + 1);
var page = fullPage.substring(0, fullPage.indexOf('.'));
var label_helpRequested = $(this).html();
HelpText.initToolTip(this);
HelpText.getHelpText(page, label_helpRequested, this);
});
HelpText.getHelpText = function(pageNameParam, fieldNameParam, element) {
var params = { pageName: pageNameParam, fieldName: fieldNameParam };
if (this._webRequest) {
// abort the previous web service call if we
// are issuing a new one and the previous one is
// active.
this._webRequest.get_executor().abort();
this._webRequest = null;
}
// this._webRequest is a handler on the async request
this._webRequest = Sys.Net.WebServiceProxy.invoke(HelpTextServiceURL,
"GetHelpText",
false, /* use GET */
params, /* parameters to the Ajax service method - case and type sensitive */
HelpText.updateTooltip, /* success callback */
null, /* failure callback */
element); /* user context - preserved info - accessed in the success callback - in this case will contain SPAN */
}
선택기 $ ('body : not (.helpText)')를 사용해 보았습니다. click (HelpText.removeTooltip); 문제를 해결하지 못했습니다. –
'
'를 사용하지 않으면 상황이 바뀌지 않습니다. – hobbs