Switching an image using jQuery

后端 未结 7 1835
醉酒成梦
醉酒成梦 2021-02-01 23:29

Is there a better, more jQuery-ish way of handling this image substitution?

var image = $(obj).children(\"img\");
if ($(image).attr(\"src\") == \"Images/TreeColl         


        
7条回答
  •  独厮守ぢ
    2021-02-02 00:15

    Not really.

    I know... extremely helpful answer. What you are doing is pretty succinct and I'm not so sure there would be anything to make it more "jQueryish" as you ask.

    now depending on how you are iterating through this if you are doing it to multiple image instances, that is where there might be some jQuery optimizations.

提交回复
热议问题