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
#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


Messages In This Thread
RE: Adding to the Pull Down menu in Touch - by GCXO - 02.06.2024, 23:23

Forum Jump: