Я не могу сфокусироваться, чтобы обновить текущее значение.Есть ли в этом коде ошибка или мне не хватает более чистого подхода?Могу ли я передать «это» или «событие»?
Я получаю эту ошибку:
'focused is not defined'
У меня есть этот блок кода:
$("input, select, textarea, button, .link, div, .button").live({
click:clearDefault,
focusin:function() {focused = ($(this).attr('title'))},
focusout:function() {focused = false},
mouseover:onHelp,
mouseout:helpFallback
});
Какойсопоставляется с этими функциями:
function onHelp() {
if (!helpDiv) {
helpDiv = $('#helpText');
}
var $this = $(this);
var text = $this.attr('title');
if ($this.attr('titlehtml')) {
var text = $this.attr('titlehtml');
}
if ($this.hasClass('screenshot')) {
text += "<img src='images/icon_table_" + $this.attr('id') + ".png' >";
}
if ($this.attr('errorhtml')) {
text += "<div id='userError'>"+$this.attr('errorhtml')+"</div>";
}
helpDiv.show().html(text);
}
function helpFallback() {
if (focused) {
helpDiv.show().html(focused);
} else {
helpDiv.hide();
}
}