onblur event not working for span element

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gsherp
    New Member
    • May 2007
    • 34

    onblur event not working for span element

    I have an element that is a span. The span is filled in with data using innerHTML.

    Code:
    var celldes = row.insertCell(2);
        var des = document.createElement('span');
        des.id='desc' + iteration; 
        des.name='desc' + iteration; 
        celldes.appendChild(des);
        des.innerHTML = " ";
    
    des.onchange = function(){ SOME CODE }; //WORKS
    des.onblur = function(){ SOME CODE }; //NO RESPONSE
    the onchange event works, but the onblur event has no response
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    I'm not sure,but I don't think onblur is supported for the span tag. Does the span element ever receive focus?

    Comment

    • gsherp
      New Member
      • May 2007
      • 34

      #3
      The onblur only works if inside the span element there is an input field.
      then the onblur is connected to the blurring action on the input field.

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Originally posted by gsherp
        The onblur only works if inside the span element there is an input field.
        then the onblur is connected to the blurring action on the input field.
        That confirms what I thought.

        Comment

        Working...