DWQA QuestionsCategory: ProgramHow is the value of the pass through variable of the live event passed
2ming asked 1 month ago
$('.new_general_attr').find('input').live({ 

focus:function(event) {
    var thiz = $(this);
    If (thiz. Val() = 'input attribute' | thiz. Val() = = 'input attribute value') thiz. Val (');
    thiz.css({color: '#000'});
},
blur:function(){
    var thiz = $(this);
    If (thiz. Val() = '') thiz. Val ('focus default ');
    thiz.css({color: ''});
}
});

I want to ask how to pass variables between two events bound by live. For example, I want to pass the value of thiz. Val() in focus event to blur event

Humphry replied 1 month ago

Events cannot directly transfer variables to each other. Generally, they cache and read the corresponding content through variables or DOM attributes that can be accessed in the scope chain.