Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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');
    // }
    });
}); 
Posted
Comments
hansoctantan 8-Jun-12 5:11am    
This is just a suggestion...
How about try putting a global boolean variable then
When textbox has GotFocus make that variable true
If user Click on dialog box execute the function
OnBlur on textbox make the variable false

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900