JSFiddle - React, Tailwind, and code Playground

by Kim Thuy

HTML

<div class="alert alert-success well">
        <h3>Hiển thị ngẫu nhiên</h3>
        <strong id="whichLi"></strong>
        <ul id="randomize">
          <li> <span class="whichLi"></span>
              <audio controls>
  <source src="http://k002.kiwi6.com/hotlink/oj4337y666/hoa_tim_ngoai_san--elvis_phuong.mp3" type="audio/mpeg">
Your browser does not support the audio element.
                  </audio><br/>
                  Hoa tím ngoài sân
            </li>
          <li> <span class="whichLi"></span>
              <audio controls>
  <source src="http://k002.kiwi6.com/hotlink/in5c2r7a3o/toi_ru_em_ngu--elvis_phuong.mp3" type="audio/mpeg">
Your browser does not support the audio element.
                  </audio><br/>
                  Tôi ru em ngủ
            </li>
          <li> <span class="whichLi"></span>
              <audio controls>
  <source src="http://k002.kiwi6.com/hotlink/nf066ae74j/loi_cu_ta_ve--bang_kieu.mp3" type="audio/mpeg">
Your browser does not support the audio element.
                  </audio><br/>
                  Lối cũ ta về
            </li>
          <li> <span class="whichLi"></span>
             <audio controls>
  <source src="http://k002.kiwi6.com/hotlink/66u0n8s0je/giot_nang_ben_them--thanh_lam.mp3" type="audio/mpeg">
Your browser does not support the audio element.
                 </audio><br/>
                 Giọt nắng bên thềm
            </li>
          <li> <span class="whichLi"></span>
              <audio controls>
  <source src="http://k002.kiwi6.com/hotlink/33mw211744/dua_em_tim_dong_hoa_vang--khanh_linh.mp3" type="audio/mpeg">
Your browser does not support the audio element.
                  </audio><br/>
                  Đưa em tìm động hoa vàng
            </li>
          <li> <span class="whichLi"></span>
              <audio controls>
  <source src="http://k007.kiwi6.com/hotlink/wulp9njnrs/L_Th_-_Tr_n_Th_i_H_a.mp3" type="audio/mpeg">
Your browser does not support the audio element.
                 ...

JavaScript

$(function(){
		$('#randomize li').each(function(){
			$(this).hide();
		});
		var min = 0;
		var max = $('#randomize li').length;
		var randomLi = Math.floor(Math.random() * (max - min)) + min;
		$('#randomize li').eq(randomLi).show();
	});