views:

15

answers:

1

Hello

If I have the following markup

<div id="previewNote" class="note yellow" style="left:25;top:25px;z-index:1;">
   <div class="body"></div>
   <div class="author"></div>
   <span class="data"></span>
</div>

I can select the "previewNote" DIV either by using

$("#previewNote")

or

$("[ID$=previewNote]")

and with even other ways. When my element is inside a dialog window usually the first method does not work but the second does.

Which are the differences between the two?

thanks!

+1  A: 

$("#previewNote") selects element whose id is previewNote
$("[ID$=previewNote]") selects element whose id ends with ($) previewNote

More Info: http://api.jquery.com/attribute-ends-with-selector/

Sarfraz
@Sarfraz: Thanks! Could you please give more info on why using the first method does not work when I am inside a dialog and the element is inside the dialog itself?
Lorenzo