Auto select single group membership type

From UnionCloud Support
(Redirected from Auto select only membership)
Jump to: navigation, search

When a student joins a group, they have to select a membership type for the group. When there is only a single membership type for the group, the platform still requires the student to select it.

The following code snippet, which should be put in Global Javascript, will automatically select the membership type if there is only one membership type listed on the page.

1 $(function() {
2     if (window.location.pathname.substring(window.location.pathname.length - 5) == '/join' || window.location.pathname.substring(window.location.pathname.length - 5) == 'join/') {
3         if ($('.memberShipType').length == 1) {
4         	$('.memberShipType').click();
5         }
6     }
7 });