[removed] Changing src-attribute of a embed-tag

后端 未结 6 1233
失恋的感觉
失恋的感觉 2020-11-27 07:27

I have the following scenario.

I show the user some audio files from the server. The user clicks on one, then onFileSelected is eventually executed with both the sel

6条回答
  •  一整个雨季
    2020-11-27 08:08

    JQuery follows the CSS-esque declaration:

    Instead of doing

    function onFileSelected(file, directory) {
       jQuery('embed#audio_file').attr('src', '/resources/audio/'+directory+'/'+file);
    };
    

    Rather do

    function onFileSelected(file, directory) {
       jQuery('#audio_file').attr('src', '/resources/audio/'+directory+'/'+file);
    };
    

    That way, jQuery only retrieves object of id="audio_file".

提交回复
热议问题