语义UI-如何获取活动输入元素的数据? [英] Semantic UI - How to get data of active Input Element?
本文介绍了语义UI-如何获取活动输入元素的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获取urlData对象的输入字段的值?
how can I get the value of the input field to the urlData Object?
<input id="username">
JS是:
$('#username').api({
action: 'check username',
urlData: {username: $(this).val()},
onSuccess: function(response){
console.log(response)
},
onError: function(error){
console.log(error)
}
});`
使用普通的JQuery
我可以使用$(this).val();
来获得它.但是在这种情况下,它是空的.它如何与语义UI一起使用?
With normal JQuery
i can get it with an $(this).val();
. But in this case it´s empty. How does it work with Semantic UI ?
推荐答案
您可以尝试
$( "#username" ).keyup(function() {
var value=$(this).val();
$('#username').api({
action: 'check username',
urlData: {username: value},
onSuccess: function(response){
console.log(response)
},
onError: function(error){
console.log(error)
}
});
});
这篇关于语义UI-如何获取活动输入元素的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文