显示警报,而不是在jquery中重新加载 [英] show alert and not reload in jquery
本文介绍了显示警报,而不是在jquery中重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hi
i想要使用onclick for button ,,如果textbox为空,则在页面顶部显示警告(TExtbox为空),并保持在同一页面上,无需重新加载或刷新
如何使用jquery / javascript onclick功能这样做
问候
maulik shah
解决方案
< blockquote>检查:使用JavaScript的客户端验证 [ ^ ]
Hi Mauli,
您可以试试这段代码
< !DOCTYPE html >
< html >
< body >
< script language = javascript type = text / javascript >
<! -
function validate(){
var text = document.getElementById('txtbx')。value;
if(text ==)
{
alert('TextBox is empty');
location.reload();
}
}
// - >
< / script >
< 输入 类型 = text id = txtbx / >
< 输入 type = 按钮 的onclick 温泉n> = validate(); value = 点击我 < span class =code-keyword> / >
< / body >
< / html >
希望这对你有所帮助。
问候,
RK
hi
i want to use onclick for button ,, and if textbox is empty show alert on top of page (TExtbox is empty) , and stay on same page without reload or refresh
how to do this using jquery /javascript onclick function
regards
maulik shah
解决方案
Check this: Client Side Validation using JavaScript[^]
Hi Mauli,
You could try this code
<!DOCTYPE html> <html> <body> <script language="javascript" type="text/javascript"> <!-- function validate() { var text = document.getElementById('txtbx').value; if (text == "") { alert('TextBox is empty'); location.reload(); } } //--> </script> <input type="text" id="txtbx"/> <input type="button" onclick="validate();" value="Click me"/> </body> </html>
Hope this helps you a bit.
Regards,
RK
这篇关于显示警报,而不是在jquery中重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文