私は、Idの一部を含むかどうかに基づいてdivを表示して表示するスクリプトを作成し、その関数に渡された一意の完全IDを含むdivを表示します。関数は次のようになります:jQuery hidden with attributesStarts期待どおりに動作しない
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によれば正しいことを確信しています。私は行方不明の何か他にありますか?ヘルプは高く評価されます。
$('div[id^="plot_"]').hide(); // you were missing the last ]
関数が正しく呼び出されていますか? –