Is there a more efficient way of storing my checkbox values?
Each checkbox has an assigned value, I was wondering if there was a better way of storing these values (destinationoflink1,2,3,etc)? perhaps store them as an array and call them?...although I am unsure
HTML page extract:
<form>
<label for="checkbox1">Link #1</label>
<input type="checkbox" id="checkbox1" value="http://www.destinationoflink1.com">
<label for="checkbox2">Link #2</label>
<input type="checkbox" id="checkbox2" value="http://www.destinationoflink2.com">
<label for="checkbox3">Link #3</label>
<input type="checkbox" id="checkbox3" value="http://www.destinationoflink3.com">
<input type="button" value="open links" id="open_link"/>
</form>
Javascript file extract (if useful):
$("#open_link").click(function() {
performOpenLink();
})
function performOpenLink(){
$("input[type=checkbox]").each(function() {
if (this.checked) {
window.open(this.value)
}
});
}