[英]JS wai-aria and dynamic content loaded with jQuery
我正在編寫一個使用twitter bootstrap
和aria
的Web應用程序。 我有帶排序選項的表,看起來: 。 我的內容是使用
jQuery.html()
函數動態加載到#content div
。 當我按F5
一切正常,但是當我通過jQuery將內容加載到包含這些表的div中后,出現了問題。 表格會丟失其搜索選項和分頁欄。 。
很少有功能會停止工作。 如何將動態內容加載到#content div
?
我當前的代碼:
this.getContent = function(page){
var self = this;
$('#center-column').removeAttr("class");
if (page.indexOf('&') > 0)
$('#center-column').addClass( page.substr(0, page.indexOf('&') ) );
else $('#center-column').addClass( page );
$.get( $('body').attr('id')+".php?page="+page+"&mode=ajax",
function(data){
self.fetchData( data );
}, "json");
}
this.fetchData = function(data){
if (data.redirect_url != null)
window.location = data.redirect_url;
$("#content").html( data.html );
}
aria有什么方法可以動態更改div的內容並調用?
當我通過jQuery將內容加載到包含這些表的div中后,出現了問題。 表格丟失了搜索選項和分頁欄
使用.wrap
在現有標記周圍添加動態內容:
$("#content").html( $(data.html).wrap("#content") )
aria有什么方法可以動態更改div的內容並調用?
使用aria-live
屬性以指示內容是動態的, assertive
的價值。
$("#content").attr("aria-live", "assertive")
參考文獻
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.