arron3
09-06-2008, 12:39 PM
<script Language="JavaScript">
function removeElement(ele){
pieces = ele.split("_");
var ele = pieces[0]; ele.parentNode.removeChild(ele);
}
</script>
<div id="1">Industrial Goods <input type="button" value="Delete" onClick="removeElement(1_1)"> <br> </div>
So, the div ID is "1" and the variable passed is 1_1, I want to split 1_2 ( using the underscore to split it) > then use the splitpiece[0] to identify the div="1" tag and delete it.....
But it isnt working for some reason...
Thanks!
function removeElement(ele){
pieces = ele.split("_");
var ele = pieces[0]; ele.parentNode.removeChild(ele);
}
</script>
<div id="1">Industrial Goods <input type="button" value="Delete" onClick="removeElement(1_1)"> <br> </div>
So, the div ID is "1" and the variable passed is 1_1, I want to split 1_2 ( using the underscore to split it) > then use the splitpiece[0] to identify the div="1" tag and delete it.....
But it isnt working for some reason...
Thanks!