Это самый простой способ, на мой взгляд:
// All buttons where id contains 'rbutton_'
const $buttons = $("button[id*='rbutton_']");
//Selected button onclick
$buttons.click(function() {
$(this).prop('disabled', true); //disable clicked button
});
//Enable button onclick
$('#enable').click(() =>
$buttons.prop('disabled', false) //enable all buttons
);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button id="rbutton_200">click</button>
<button id="rbutton_201">click</button>
<button id="rbutton_202">click</button>
<button id="rbutton_203">click</button>
<button id="rbutton_204">click</button>
<button id="rbutton_205">click</button>
<button id="enable">enable</button>
Вам нужен PHP для этого, взгляните на http://php.net/manual/en/function.readdir.php
Из документации PHP:
$handle = opendir('/path/to/files')
/* This is the correct way to loop over the directory. */
while (false !== ($entry = readdir($handle))) {
//Do something with $entry
}
closedir($handle);
Более простой способ сделать это - использовать glob () :
foreach(glob('path/to/file/*.mp3') as $entry)
//Do something with $entry
Он также отфильтровывает файлы, не относящиеся к mp3