Postingan lainnya
Seleksi semua kelas di jquery kecuali yang di klik
saya membuat banyak tombol yang sama dengan kelas "poin" dan class uniq "poin-1" dst. Saya ingin saat klik poin1, maka semua tombol dengan kelas poin saya hide, kecuali yang saya klik
$(".poin").click(function () {
$('poin').hide();
})
4 Jawaban:
Jawaban Terpilih
<pre> $(document).on('click', '.poin', function() { $('.poin').hide(); $(this).show(); }); </pre>
Kurang lebih seperti itu bro. Atau lebih detail bisa cek di stackoverflow <a href=' https://stackoverflow.com/questions/30589894/hide-the-all-other-divs-except-one-which-is-clicked '>Hide the all other div's except one which is clicked</a>
Tanggapan
thanks gan, solved
mungkin lebih tepatnya ini <a href=' https://stackoverflow.com/questions/4161869/jquery-how-to-select-all-the-class-elements-start-with-text '>jquery how to select all the class elements start with “text-”</a>
<pre> $('.poin-1').click(function () { $('*[class^="poin"]').hide(); $('.poin-1').show(); }) </pre>