Jquery attr('src') undefined in IE 8 (works in FF)

前端 未结 7 1645
广开言路
广开言路 2021-01-18 07:22

This has gotten so far,that I will sum up what we found out:

  • Inside the event handler the attribute src cannot be read in IE8 (FF works fine), neither with

7条回答
  •  鱼传尺愫
    2021-01-18 08:01

    children looks for immediate child elements only where as find looks for all the elements within it until its last child element down the dom tree. If you are saying find is working that means the element you are looking is not its immediate children.

    Try to alert this jQuery(this).children('#Image_center').length see what you get.

    FYI. Even when any element is not found jQuery will return an emtpy object it will never be null. So alert an emtpy object will always give you [object Object]. You should alwasy check for the length property of the jQuery object.

    Try this

    alert(jQuery(this).find('#Image_center').length);//To check whether element is found or not.

提交回复
热议问题