three3
three3

Reputation: 2846

Not able to access click event with jQuery selector

I am having a hard time accessing a click even with my jQuery selector. Here is my HTML:

<li class="handle-bars">
    <span class="fa fa-bars pull-right text-primary m-t-10"></span>
    <span class="fa fa-cogs pull-right text-primary m-t-10" id="trigger-modal-editor" style="cursor:pointer" data-target="#modalSlideLeft" data-toggle="modal">     </span>
</li>

Here is my jQuery selector:

<script>
$(document).ready(function() {
  $('#trigger-modal-editor').click(function() {
    alert('Hello');
  });
</script>

This is not registering the art for some reason. Any help is appreciated!

Upvotes: 0

Views: 37

Answers (1)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

You're forgetting to close the ready handler:

$(document).ready(function() {
  $('#trigger-modal-editor').click(function() {
    alert('Hello');
  });
});//this 

Also, you don't have any text inside #trigger-modal-editor, place some text there to click in.

Upvotes: 1

Related Questions