Hello i have an html list:
and i want to get either the value or name using javascript and based of the value/name change the style to display:none;Code:<ul id="carrierList"> <li class="carrierListElem" name="AmeriHealth Administrators" value="AmeriHealth Administrators">AmeriHealth Administrators</li> <li class="carrierListElem" name="Carefirst-Blue Cross Blue Shield" value="Carefirst-Blue Cross Blue Shield">Carefirst-Blue Cross Blue Shield</li> <li class="carrierListElem" name="3P ADMIN" value="3P ADMIN">3P ADMIN</li> </ul>
i currently am doing this:
however the alert message just says "undefined"Code:carrierList = document.getElementById("carrierList"); // get all list elements of the carrier list carriers = carrierList.getElementsByTagName("li"); alert(carriers[0].name); alert(carriers[1].value);
can anyone help me? i want to be able to get the contents of the li element into a string.


Reply With Quote

Bookmarks