1
好了,我的問題說明如下:如何通過jquery .html創建href,然後使用它的事件?
我有這樣的javascript代碼,以創建A HREF在表:
$('#table').html('<a name="example" class="one">One</a><a name="example" class="two">Two</a>');
然後,我想知道這a
標籤我按下....是這樣的:
$("a[name=example]").click(function(e) {
var example= $(this).attr("class");
alert(example);
}
但是,這並不工作...
你能幫助我嗎?
Thx 4 advance!
閱讀有關[__'Event delegation'__](https://learn.jquery.com/events/event-delegation/) – Rayon