我有一些jQuery的,使得鏈接,但鏈接他們應該引發更多的jQuery但他們沒有,這裏是代碼:jQuery的鏈接不工作
$(".divisionLinks").click(function() {
$('.show_hide_division').show();
$('.show_hide_main').html($(this).html()+ " is Selected");
//Load the division xml
var xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.load("xml//division//"+ $(this).html() + ".xml");
theEnvNodes = xmlDoc.getElementsByTagName('ENVIRONMENT');
//Make the html
theNewHTML = "<ul>";
for (i = 0; i<theEnvNodes.length; i++){
theNewHTML = theNewHTML + "<li><a class=\"environmentLinks\" href=\"#\">";
theNewHTML = theNewHTML + theEnvNodes[i].childNodes[0].childNodes[0].nodeValue;
theNewHTML = theNewHTML + "</a></li>";
}
theNewHTML = theNewHTML + "</ul>";
$('.environmentButtons').html(theNewHTML);
});
$(".environmentLinks").click(function() {
$('.show_hide_environment').show();
$('.show_hide_division').html($(this).html()+ " is Selected");
});
所以分工環節的工作,但環境鏈接不。 我一直在閱讀它可能是jQuery索引.environmentLink類的東西。但我不知道,也不知道是否有工作。 感謝您的幫助提前。
['live()'](http://api.jquery.com/live/)被**棄用**,讀取API。早於jQuery 1.7 ['委託()'](http://api.jquery.com/delegate/)應該使用,並在1.7 + ['on()'](http://api.jquery.com/on /)應該被使用。 –
謝謝,live()工作,但on()沒有 –
您歡迎,我在'.on()'例子中犯了小錯誤,我編輯了它:) –