Quote:
Originally Posted by WolfShade
I tried your suggestion (using on instead of each) and put it inside (at the end) of the function that inserts the anchors into the div. Still not firing, for some reason.
|
No, with the
on() function in my edited part of the post I meant to just replace that with the current each loop set-up you have.
On the other hand: Is this where the links are created?
Code:
return "<a href= blah blah blah blah blah > NAME </a>";
If that’s the case – or generally – you should work with “regular” DOM methods rather than with innerHTML type methods. For example you can do:
PHP Code:
$('#devSection').append(
$('<a>', {
href: blabla,
text: NAME,
click: function() {
// do whatever you wanna do on click
}
})
);
Using prepend() and append() you can not only add single elements to a container, you can also add document fragments you stored in a variable, e. g.:
PHP Code:
var fragment = $('<div>', {id: 'example'}).append($('<a>', {href: 'http://example.com', text: 'whatever'}));
$('#container').append(fragment);
will result in
Code:
<div id="container">
<div id="example">
<a href="http://example.com">whatever</a>
</div>
</div>