这是代码的一部分。单击按钮后,我没有得到Framesize的值。

$("#Fs").keyup(function(e){
    Framesize=this.value;
    alert(Framesize);
});
$("input:button").click(function(e) {
    alert(Framesize);
});

最佳答案

var Framesize = null;       // Put your variable in the global scope

$("#Fs").keyup(function(e){
    Framesize=this.value;
    alert(Framesize);
});
$("input:button").click(function(e) {
    alert(Framesize);
});

关于javascript - 如何在jQuery函数之外使用变量值?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/36001363/

10-09 14:41