I am having the following HTML code:
<div class="elgg-sidebar">
<h3><b>Source: </b></h3>
<input type="checkbox" id="internship[source][]" name="internship[source][]" value="S1" checked=""> S1
<input type="checkbox" id="internship[source][]" name="internship[source][]" value="S2" checked=""> S2
<input type="checkbox" id="internship[source][]" name="internship[source][]" value="S3" checked=""> S3
<h3><b>Internship Type: </b></h3>
<input type="checkbox" id="internship[int_wrk_typ][]" name="internship[int_wrk_typ][]" value="WT1" checked=""> WT1
<input type="checkbox" id="internship[int_wrk_typ][]" name="internship[int_wrk_typ][]" value="WT2" checked=""> WT2
<input type="checkbox" id="internship[int_wrk_typ][]" name="internship[int_wrk_typ][]" value="WT3" checked=""> WT3
<h3><b>Location: </b></h3>
<select style="width:200px;padding: 5px;font-size: 1.1em;color: #666;border: 1px solid #ccc;-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;" name="int_location" id="internship[int_location]">
<option value="%">Any</option>
<option value="Work from Home">Work from Home</option>
<option value="Loc1">Loc1</option>
<option value="Loc2">Loc2</option>
</select>
<h3><b>Dates: </b></h3>
Start Date:
<input value="" type="text" name="int_start" id="internship[int_start]" class="elgg-input-date popup_calendar" data-datepicker-opts="">
End Date:
<input value="" type="text" name="int_end" id="internship[int_end]" class="elgg-input-date popup_calendar" data-datepicker-opts="">
<h3><b>Keywords: </b></h3>
<input value="" type="text" name="keyword" id="internship[keyword]" class="elgg-input-text">
<input type="button" onclick="onClick_Search()" class="elgg-button elgg-button-submit" value="Search">
<input type="button" onclick="onClick_Reset()" class="elgg-button elgg-button-delete float-alt" value="Reset">
</div>
Now, I want to get all the above input, select parameters in a javascript function.
I tried document.getElementById("internship").value and document.getElementById("internship[]").value but I am not able to get the parameters. I even tried to get individual parameter using document.getElementById("internship[source]").value and document.getElementById("internship[source][]").value but still out of luck.
Can anyone help me on how to proceed with this?
idattributes doesn't behave the same asnameattributes, eachidshould be unique.