title: z-index javascript css issue
body: <p>I have dynamiclly created divs on a page that are draggable via jquery. </p>
  
  <p>I have added a small button on each div that allows the user to delete the div with a click. </p>
  
  <p>The problem I have is, I set the highlighted div as the foremost item on the page but if the div is overlapping another div and the user clicks the delete button, the div underneath is highlighed and brought to the front instead of the button being clicked.</p>
  
  <p>I have positioned the button inside the div but position does not seem to have any effect. The button is appened to the div.</p>
  
  <p>I am making the assumption that its something to do with the z-index of the button but I may be completely on the wrong track</p>
  
  <p>any help would be appreciated.</p>
  
  <p>here's the code that I use to append the button to the div. This code is called just after the div is created within the create div function loop.</p>
  
  <pre><code>  var but=document.createElement('input');
    but.setAttribute('type','button');
    but.setAttribute('class','removebutton');
    but.style.position = "absolute";
    but.style.top = "15px";
    but.style.left = +width+"px";
    but.style.float="right";
    but.style.visibility="hidden";
  
    but.onclick=function(){
      if(confirm('Really delete?'))
        {                   
         $.post("delete_box.php",{i:i, page_ref:'&lt;? echo $page_ref; ?&gt;', template_ref:'&lt;? echo $template_ref; ?&gt;'}, function(data,status){ });    
      document.getElementById("frmMain").removeChild(newdiv);
      document.getElementById(id).removeChild(but);
      document.getElementById(id).removeChild(newbr);
  
        }             
     }
  </code></pre>
  
  <p>here's the code I use to bring the clicked div to the front and push anything else back (each div has the class name of <code>dragbox</code>)</p>
  
  <pre><code>   $('.dragbox').click(function() 
        { 
           $(".removebutton").css('visibility', 'hidden');
           $(this).css({  
          'background-image':'url(img/move.png)',
          'background-repeat':'no-repeat',
          'width':'15px',
          'height':'15px',
          'zIndex':'1000'
          })
          $(this).find(".removebutton").css('visibility', 'visible');
  
    });   
  
  
  
  $('.dragbox').focusout(function() {   
      $(this).css({
                     'border', '0px',
             'background-color', 'transparent',
             'width', '0px',
             'z-index', '0'
          })      
        });   
  </code></pre>