我的代碼,我的問題是:jquery.Event動態元素
<script type="text/javascript">
$(document).ready(function() {
// this variable is used to set the dynamic elements
tagFlag = '';
$("#a1").click(function(event) {
event.preventDefault();
tagFlag = 'me'; // setting the element which I want to trigger later
});
$('#'+tagFlag).click(function(e) {
// do sthing here
});
});
</script>
</head>
<body>
<a href="">make the element</a>
<p id="me">some words here</p>
</body>
</html>
but.when我設置tagFlag,並點擊「P」沒有什麼是happen.BTW.there是錯誤時tagFlag已經什麼都沒有設置。那麼我怎樣才能得到我想要的?
非常感謝!
這沒有幫助。 – SLaks 2010-09-12 15:19:45
我試過了.Live()方法沒有改變....如果我設置tagFlag ='';我得到了這個錯誤:未捕獲的異常:語法錯誤,無法識別的表達式:# – qinHaiXiang 2010-09-12 15:26:43