[jQuery] How to select an element using its attributes

[jQuery] How to select an element using its attributes


Hi all, I am a newbie to jQuery.
I encounter a problem in the 2nd line
$(".imgs[src!=$('#photo'.attr('src')]").hover(function(){
it seems that $(".imgs[src!=$('#photo'.attr('src')]") returns no
jQuery object, while in logic it should return jQuery object.
Could anyone help to explain why?
Thank you.
The code is as follows:
$(document).ready(function() {;
            $(".imgs[src!=$('#photo'.attr('src')]").hover(function(){
                $(this).css({borderColor:"#ffff99", cursor: "hand"});
                },
                function(){
                $(this).css('borderColor','black');
                });
$(".imgs").click(function(){
                $(this).css("borderColor","white");
                $("#photo").attr("src",$(this).attr("src"));
});