我有填充,隱藏和顯示基於它是否包含一個ID的一部分div的腳本,然後顯示,包含完整的DIV不工作,唯一的ID傳遞給函數。功能如下:jQuery的隱藏與attributesStartsWith預期
function showPlot(plotId) {
// Hide all plots by switching them to a class
$('div[id^="plot_"').hide(); //<--Won't hide the divs matching that portion of the Id
// Show the selected plot by changing it's class
$('#' + plotId).show('fast');
}
的問題是.hide()函數不會隱藏指定的div預期。我可能沒有正確的語法,但我非常肯定根據API是正確的。還有什麼我失蹤?幫助表示讚賞。
是函數正確調用? –