user3501278
user3501278

Reputation: 267

How to handle click events inside bootstrap button dropdown

The change events inside the bootstrap button dropdown is not functioning. What could be the reason? How to fix this?

Below is my fiddle. I wanted to fire a checkbox changed event but surprisingly the below code doesn't fire.

http://jsfiddle.net/20hLtzvr/18/

 $('#chk0').click(function()
    {
    alert('hello world');
    });

Upvotes: 2

Views: 217

Answers (1)

T00rk
T00rk

Reputation: 2297

You forgot the " when you set the id

Replace

$('#citycountylist ul').append('<li><a href="#"><input type="checkbox" class="chk" id=' + 'chk' + index + ' />' + '&nbsp;' + json.NewYork[index].name + ' </a></li>');

By

$('#citycountylist ul').append('<li><a href="#"><input type="checkbox" class="chk" id="' + 'chk' + index + '" />' + '&nbsp;' + json.NewYork[index].name + ' </a></li>');

Upvotes: 2

Related Questions