Search code examples
selectorqtip

Browser performance. Which way is better: $('#item1 img[src]').qtip( {..}); -vs- $('#item1').qtip( {..});?


Which way is better: $('#item1 img[src]').qtip( {..}); -OR- $('#item1').qtip( {..}); ? It works both ways. Would you recommend to use img[src] as a part of the selector? Is it normal? Thank you.


Solution

  • Those are two separate things:

    $('#item1 img[src]').qtip( {..});
    

    Selects an image element within an element with id item1.

    $('#item1').qtip( {..});
    

    Selects an element with id item1.

    Also

    What does img[src] do?

    I only know that format when adding a src to it. Otherwise it does just nothing if it works.

    $('img[src*="you_src_you_want_to_select"]')