I have
<script type="text/javascript">
var battery = navigator.battery || navigator.mozBattery || navigator.webkitBattery;
</script>
<input name="battery" type="hidden" value="">
And I want to replace the battery’s value to the input but how?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
this only works if your input is the first with the name battery. If you can give it an id (the input), you can use document.getElementById(“id”), wich always exactly returns one element; multiple elements with the same id are not “allowed”.