Solved

mouseout is not working as expected

Posted on 2014-12-13
1
95 Views
Last Modified: 2014-12-14
I'm dynamically generating a list of checkboxes, I want this to dissapear as soon as I mouse out, but it dissapears
when I move my mouse out of Fldsbutt

<div class="container" id = "container"> 
        <div class="form-group">         
                <label for="selfile" class="col-sm-2 control-label">  Select File </label>  
                        
                <?php
                
                    $options = generate_files();
                    echo '<select id="selfile" name="selfile">'.$options.'</select>';                    	        
                ?>
              
        </div>
       
       
          <div class="form-group"  id="fieldsdiv" >         
              <label for="selfile" class="col-sm-2 control-label">  Fields </label> 

        	
        	 			   
        	    <button id="Fldsbutt"  class = "multiSelect ui-widget sd ca"  type="button"  tabindex = "0" style="width:225px;">
        	    
            	     <span class="ui-icon ui-icon-triangle-2-n-s"></span>
            	     <span id="Pstext" class= "ui-text"> </span>
            	     
        	     </button>    <span id="pleaseWait"> </span>
        	     
            	    <div id="selfields" class="multiSelectOptions">
            	    	    
            	    </div> 	
        	     	
        	    <span id="Pss">     </span> 		 		   		 		
             </div>		  	  	 	 	  	 	  		 		  	  										
 	 
          
        
              
          
       
            
                         
    
            
      </div>      
   
   <script>


   
   var base_url = '<?php echo site_url() ?>';
   var controller = 'gen';
   var method = 'mixed';

    $(function() {	
	   $('#selfile'). change(function() {
			 
		   var $file = $('#selfile').val();
		      		      
		      if($file !== undefined)
		      {
		    		
		    	     var	 $path = $file;    
  		    	        		    	   	    	    			     
  		    	 $.ajax({							
  						url: base_url+'/'+ controller +'/' + method,
  						type: "POST",
  						data: {
  							file: $path,
  							},
  						success: function(ret_data) {
      						if (ret_data != 'error')
      						{	
      							$('#pleaseWait').html('Click the arrow to select fields');
      						    $('#selfields').html(ret_data);
      						    $('#selfields').hide();
      					     } 

      						else  	$('#pleaseWait').html('');
  						}			
  						}); 
		      }	    });
		
		
		$('#selfields').mouseout(function() {
			    console.log('mouseout');
			    $('#selfields').hide();
							

			});
		    	    

		$('#Fldsbutt'). click(function() {
	 
		    $('#selfields').show();
		    
		   });  		
		});	
		
	       
  </script> 
  
 </body>
 </html>  

Open in new window

0
Comment
Question by:sniger
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 30

Accepted Solution

by:
Alexandre Simões earned 500 total points
ID: 40498865
For me it works perfectly.

I think probably you're forgetting that selfields is a div and is using the whole width.
So even if you're entering an area that looks like it doesn't belong to it, chances are that it is.

Just to make sure try setting a border for that div to have a visual reference o fit's boundaries:
.multiSelectOptions{border: solid 1px #000;}

Open in new window


Here's the fiddle that I used to test: http://jsfiddle.net/AlexCode/o7vuko5t/
Looks bad, and I disabled all the dynamic stuff, but it's enough to test the scenario.
0

Featured Post

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question