I'm having trouble using the appendChild function...
here's my code
<!DOCTYPE html>
<html>
<body>
<form oninput="x.value=((parseFloat(winning_number.value)%(parseFloat(total_key_value.value)*100*2))/(parseFloat(total_key_value.value)*2)).toFixed(2)">
<input type="number" id="winning_number" value="" placeholder="Winning Number"> ~
<input type="number" id="total_key_value" value="" placeholder = "Total (Keys)">
= <output name="x" for="winning_number total_key_value"></output>%
</form>
<button type="submit" onclick="document.getElementById("container").appendChild(li);">Submit</button>
<ol id="list"></ol>
</body>
</html>
i enter 2 numbers and it will calculates the result using a formula.
how can i make a button that will add the x value to a list once clicked?
also, i want to be able to delete items from the list if that's possible
im very new to javascript as you might realize
thanks
<button type="submit" onclick="document.getElementById("container").appendChild(li);">Submit</button>on your example your ol id is not containercontaineris matching the quote afteronclick=, so it's ending the attribute. Use single quotes around strings when they're inside a double-quoted attribute, or vice versa.li?onclickattribute. You need to calldocument.createElementto create the newli, fill the element with the appropriate contents, then callappendChild. You might want to learn jQuery, it makes it a little easier.