2013-06-25 33 views
0

我使用http://jqueryui.com/selectable/#display-grid與選項多選擇像我在這裏做替換文本:https://stackoverflow.com/questions/16269438/how-can-i-select-and-deselect-multiple-grid-icons-in-javascript-and-show-the-sel在JQuery用戶界面電網可選擇一個新

任何人都可以解釋爲什麼我可以取代「標題」文本信息-2,但裏面沒有文字Info-1標誌!

<li class="ui-state-default" title="Info-2">Info-1</li> 

這一個是工作的罰款:

$('li').each(function(index, temp){ $(temp).attr('title', ar[index+1][kLan]); }); 

但不是這一個:

$('li').each(function(index2, temp2){ 
    var tmp = $(temp2).text(); 
    $(temp2).attr(tmp, ar[index2+1][kLan]); }); 

這是錯誤,我得到:

jQuery的1.9.1 .js:2358INVALID_CHARACTER_ERR:DOM例外5:指定了無效或非法字符ied,如XML名稱。

回答

0

我發現了這個問題,我自己:

$('li').each(function(index, temp){ $(temp).html(ar[index+1][kLan]); }); 

現在所有工作正常!

相關問題