jQuery blur()函数事件仅在对话框中显示 [英] jquery blur() function event only in the dialogue bo
本文介绍了jQuery blur()函数事件仅在对话框中显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
您能这样做,.blur()函数仅在客户端单击对话框框时才检查输入字段吗?现在,当我单击页面内的任何位置时,它会检查输入字段
这是我的js代码
Hello Everyone!
Can you do this, that the .blur() function just only check the input field when the client clicked on the dialoque box? Now when I click anywhere inside the page, it check the input fields
This is my js code
$(document).ready(function(){
$(''#tempForm'').dialog({
draggable: false,
height: "450",
width: "600",
resizable: false,
closeOnEscape: false ,
title: "Registration",
buttons:{
"SUBMIT" : function(){
$(''#tempForm'').submit();
}
}
});
$(''#txt_username'').blur(function(){
// if($(''#txt_username'').val().length < 6 || $(''#txt_username'').val().length > 12)
// {
// alert(''Username must be between 6 and 12 characters'');
// }
// else
// {
$.post(''http://localhost/Image2/index.php/welcome/checkUsername'',
{
"username":$(''#txt_username'').val()
},
function(data){
if(data.username == ''true''){
// console.log(data.username);
// alert(data.username);//itt kiirja hogy true az alert
alert(''Hasznalatban van a usernev'');
}else{
alert(''nincs hasznalatban'');//ide sosem jon el
// alert(data.username);
}
//
// else{
// alert(''username ok use it'');
// }
}, ''json'');
// }
});
});
推荐答案
(document).ready(function(){
(document).ready(function(){
(''#tempForm'').对话({ 可拖动的:false, 高度:"450", 宽度:"600", 可调整大小:假, closeOnEscape:false, 标题:注册", 纽扣:{ "SUBMIT":function(){
(''#tempForm'').dialog({ draggable: false, height: "450", width: "600", resizable: false, closeOnEscape: false , title: "Registration", buttons:{ "SUBMIT" : function(){
(''#tempForm'').submit(); } } });
(''#tempForm'').submit(); } } });
这篇关于jQuery blur()函数事件仅在对话框中显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文