I have two pages, so i'm sending data from one page to another page. and getting the data in another page. I'm assigning the value to to input field using document.getElementsById
but i want to do the by using document.getElementsByClassName
. When i'm trying to push the value using class name it's not working. How can i do that using class name, if i wan't to get the same value in two or three input fields
page1.html
<form action="form.html" method="GET" class="text-center">
<input type="text" name="job_id" value="NC-004" style="display: none" />
<input type="submit" value="Apply" class="btn btn-primary" />
</form>
I'm getting the value in next page using window.location.search
<input type="text" class=" form-control" id=""write value="" />
<script>
var n = window.location.search.slice(8);
console.log(n);
document.getElementsById("write").value = n;// want to update the value using document.getElementsByClassName
</script>