Jquery selector

Hello Folks,

Can any one tell what the below jquery code means

$('img, .small-message', '#container')

(just confused tag and class name within a quote and again comma with an id what does it means?)

Html:

<div id="container">
     <label>Enter the code</label>
     <input maxlength="5" size="5" class="input_code" title="" type="text" value="" name="code_holder">
     <img src="image.jpg">
     <div class="small-message">Sample Text</div>
     <div class="clear"></div>
     <div id="error-message"></div>
</div>

The first two before the comma are the selectors. The last is the context.
http://api.jquery.com/jquery/#jQuery-selector-context
Context meaning when those selectors are found within it.

Another way to write it would be (in CSS format)

#container img
, #container .small-message {
}
1 Like

Thanks alot Mitteineague…:slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.