jquery selector help... thought I followed the example correctly...but can't get it to work..

Posted by Ronedog on Stack Overflow See other posts from Stack Overflow or by Ronedog
Published on 2010-03-22T18:27:10Z Indexed on 2010/03/22 18:31 UTC
Read the original article Hit count: 302

Filed under:
|

I'm trying to do the following in jquery but can't make it work .

I want to select all the DIV tags that have a custom attribute called NODE_ID that have a value of 49_3. then select the and change the src attribute to a different image.

Here's the HTML:

<div style="display: block;" id="71_7_sub_p_div" node_id="49_3">
    <span>
        <img src="../images/maximize.png"> &nbsp;Greenfield Industrial Park
    </span>
</div>   

Here's the script:

<script type="text/javascript">
    $(document).ready(function(){
        $("div[node_id='49_3']:has(img)").attr("src","../images/folder_closed.png");
    });
</script>

Any ideas are appreciated. thanks.

© Stack Overflow or respective owner

Related posts about jquery-selectors

Related posts about jQuery