Last active
December 7, 2015 13:59
-
-
Save cdmz/c6f357ca4dc14038f862 to your computer and use it in GitHub Desktop.
create li a javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function add_li_link(label,url,ul_class){ | |
| var ul = document.getElementsByClassName(ul_class)[0]; | |
| var ul = ul.getElementsByTagName("ul")[0]; | |
| var li = document.createElement("li"); | |
| var a = document.createElement("a"); | |
| a.href = url; | |
| a.appendChild(document.createTextNode(label)); | |
| li.appendChild(a); | |
| ul.appendChild(li); | |
| } | |
| add_li_link('Nossas Fazendas','nossas-fazendas.php','sub'); | |
| add_li_link('Tecnologia e Pesquisa','tecnologia-e-pesquisa.php','sub'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment