Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function backgroundchange(iditem) {
- const selectId = `selectstatus${iditem}`
- const selectedDisplay = document.querySelector(`#${selectId} ~ .dropdown-menu .selected a`)
- const select = document.getElementById(selectId);
- const styleElement = document.getElementById(`stylestatusselection${iditem}`);
- const [statuscode, ...statuscolorchars] = select.options[select.selectedIndex].value;
- const statuscolorcode = statuscolorchars.join('');
- styleElement.innerHTML = `
- #${selectId} ~ .dropdown-menu .selected a,
- .statusselectionbackground${iditem} {
- background-color: #${statuscolorcode}
- }`;
- // Remove style attribute from all dropdown options
- // I'm not sure where this style attribute was initially set.
- // If you find where that happens, you can just remove that code,
- // which would make the following two lines superfluous.
- const links = document.querySelector(`#${selectId} ~ .dropdown-menu`).querySelectorAll('a')
- links.forEach(option => option.removeAttribute('style'))
- $.ajax({
- url: `backofficerequestsstatusupdate.php?requestorid=${iditem}&statuscode=${statuscode}`,
- method: 'get',
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement