I'm trying to get the input type value's from input fields that have been generated by a webshop framework. I can't change the html. When I added fields it creates this:
<input id="filter_15" type="checkbox" name="filter[]" value="15">
<input id="filter_16" type="checkbox" name="filter[]" value="16">
<input id="filter_17" type="checkbox" name="filter[]" value="17">
I found some code that gets the value based on the input id, except that the id's filter_... can change, and are different for every shop.
any sugestions? here's what i've gathered so far.
<script type="text/javascript">
var filter;
function onload() {
filter = document.getElementById('filter');
}
function show() {
alert(filter.value);
}
document.querySelectorAll('input[type="checkbox"]');is usefull here. It'll return your a node list containing all the inputs of the type checkbox. Then you can loop over them and get the values.