[jQuery] event binding issue
hello friends,
i'm injecting a menu ( UL > LI > A markup) and binding each A anchor a
click event, but the event fails to trigger. Can you explain me what
i'm dooing wrong?
here is the code sample:
$('<a>' + linkText + '</a>').appendTo($dsanchors).attr({
'href': '#' + index,
'id': index,
'class': (linkText == selected) ? 'selected' : 'notSelected'
}).bind('click', function()
{
alert("hi");
return false;
}).wrap('<li></li>');
the html is correctly injected, but the event is not attached.