This trick might be useful when you need to add extra functionality to your Moodle site, but you don't want to modify the PHP code because
The course ID is in the BODY tag as a CLASS among other useful information about the course/page.
the steps are:
Now, if you go back to the button you created previously and click on it, it will open a new tab showing all the assignments in the course where the button sits.
You can use the "MyOwnButton01" button in other courses as well.
If you need more than one button on the same page, change the button ID to a class and change your code as well to trigger the click event.
The buttons are:
The modified JQuery is