简体   繁体   English

如何将jQuery函数值传递给变量?

[英]How to pass jQuery function value to variable?

I have this variable: 我有这个变量:

var tt_topiclist_fontsize = '{TT_topiclist_fontsize}';

and this small function: 这个小功能:

$('input#TT_topiclist_fontsize.type-form').on('keyup', both);

function both(){
  window.opener.$('#header-site-description h1').css('fontSize', this.value + 'px');
}

So when I in input type in desired font size (some number), how can I pass that value to above variable ? 因此,当我以所需的字体大小(某个数字)输入类型时,如何将该值传递给上面的变量?

Thank you 谢谢

var tt_topicList_fontsize ;
$('input#TT_topiclist_fontsize.type-form').on('keyup', function both(){
window.opener.$('#header-site-description h1').css('font-size', this.value + 'px');
tt_topicList_fontsize = this.value;
});

try this! 尝试这个!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM