0

Why is this not possible?

$(function() { 
    $('.link').on('click', function(e) {
    alert('Works');
    });     
});

$(document).ready(function() {
$('#link').html('<a href="#" class="link">Link</a>');
});

HTML

<div id="link"></div>

It works if i delete the DIV and manually write the HTML:

<a href="#" class="link">Link</a>
Stefan Frederiksen
  • 135
  • 2
  • 3
  • 15

0 Answers0