Get Clicked from

You can use event.target for this: JS: // IE does not know about the target attribute. It looks for srcElement // This function will get the event target in a browser-compatible way function getEventTarget(e) { e = e || window.event; return e.target || e.srcElement; } var ul = document.getElementById(‘test’); ul.onclick = function(event) { var target … Read more

Adding text before list

You need CSS counters: #customlist { /* delete default counter */ list-style-type: none; /* create custom counter and set it to 0 */ counter-reset: elementcounter; } #customlist>li:before { /* print out “Element ” followed by the current counter value */ content: “Element ” counter(elementcounter) “: “; /* increment counter */ counter-increment: elementcounter; } <ol id=”customlist”> … Read more

RecursiveIteratorIterator and RecursiveDirectoryIterator to nested html lists

Here is one using DomDocument The basic idea is the contents of each directory is represented by a <ul> and each element in the directory by a <li> If element is a non-empty directory it will contain a <ul> to represent its contens and so on. $path = $_SERVER[‘DOCUMENT_ROOT’].’/test’; $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); … Read more

How to style the number on a html list?

It can be done using CSS3 but not 100% cross browser (namely IE7). using the pseudo :before element and counter-reset and counter-increment you can hide the list-style and create your own. here is an article outlining how: Styling ordered list numbers and here is a demo built from that article. Also in case of the … Read more

Can you style ordered list numbers?

You can do this using CSS counters, in conjunction with the :before pseudo element: ol { list-style: none; counter-reset: item; } li { counter-increment: item; margin-bottom: 5px; } li:before { margin-right: 10px; content: counter(item); background: lightblue; border-radius: 100%; color: white; width: 1.2em; text-align: center; display: inline-block; } <ol> <li>item</li> <li>item</li> <li>item</li> <li>item</li> </ol>