This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Adding to the Pull Down menu in Touch
#1
Hi,

Is there a way to add an option in the pulldown menu in the touch interface to perform an action as setting a Objectvalue to a certain value or maybe run a function in javascript?

   


For example I would like to add under General , Turn off alarms, which I need to send a value do an grpip.

Thanks,

Gabe
Reply
#2
I've figured it out. For anyone else who needs to do this



Code:
document.addEventListener('DOMContentLoaded', function() {
        var container = document.querySelector('.sidebar');
        var ul = container.querySelector('ul');
        var li = document.createElement("li");
        var span = document.createElement("span");
        span.classList.add('a');
     
        var link = document.createElement("a");
        link.href = "#"; 
        link.textContent = "Nuevo Link"; 
       
        span.appendChild(link);
 
        li.addEventListener('click', HaceClick);
        li.classList.add('level-1');
        li.appendChild(span);
     
 
        var referenceNode = ul.getElementsByTagName("li")[3]; // Insert before 3rd in the list
        ul.insertBefore(li, referenceNode);   
  });

function HaceClick() {
        alert('Ha pulsado Nuevo Link!');
     
    }


It will appear in the left sidebar menu


   
Reply


Forum Jump: