简体   繁体   中英

Remove an item from the drop down menu

I want to remove BOX from the list:
我想从列表中删除 BOX

In my .js file I use:

$('#context_external_tools_select li:contains("BOX")').remove();

It works in the console but it does not work after I upload the JavaScript to the server. By the way, it is Canvas LMS.

Wrap it in document.ready

$(document).ready(function () {
    $('#context_external_tools_select li:contains("BOX")').remove();
});

Most likely the reason this works in the console is you're executing the code after the DOM has fully loaded. If this doesn't work with document.ready, you need to check your console for errors.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM