Reputation: 595
I have a code snippet like this : (notice frame_bookmark has z-index 100)
<div id="select_bar">
<div class="frame_bookmark" style="position:absolute;top:1px;left:695px;z-index:100;width:15px;height:15px;background:#df3367;border-radius:10px;">
</div>
</div>
The alert box is shown when I have JavaScript like
$("#select_bar").click(function()
{
alert('down');
});
But not shown when I have JavaScript like:
$(".frame_bookmark").click(function()
{
alert('down');
});
Upvotes: 0
Views: 568
Reputation: 337
form my understanding when you call a ID in jquery just like JavaScript it defaults at eq(0).
but when using the attributes class / name you want to specify your indexed numeric for
example
$(".frame_bookmark:eq(0)") / $(".frame_bookmark").eq(0)
and or use the .each function
Upvotes: 0
Reputation: 1569
check this out http://jsfiddle.net/ your code is pretty working )
Upvotes: 0
Reputation: 9039
If the code you posted is exactly your code, your missing a closing </div>
which will definitely mess you up. It should be:
<div id="select_bar">
<div class="frame_bookmark" style="position:absolute;top:1px;left:695px;z-index:100;width:15px;height:15px;background:#df3367;border-radius:10px;"></div>
</div>
Upvotes: 1