我正在尝试创建一个按钮,当用户在文本框上写东西时。我可以创建一个新的
用户单击按钮时使用jQuery的按钮,但如何立即创建新按钮
当用户使用JQuery输入一些值时?
感谢...
答案 0 :(得分:0)
首先,您不断获取/读取用户输入的值,然后检查它是否与您的目标词匹配
与此类似的代码:
$("#myTextField").on("keyup change ", function () {
//Now you want to compare your code here
var text = $(this).val();
if(text.indexOf("YES") > -1 )// -1 is the index of the string, -1 means it doesn't exist. 0 means it's the first occurrence in the string. 1 means it's at index 1.
{
//Create your button here.
}
})
答案 1 :(得分:0)