I am having a bit of trouble figuring out how to create an array of URL's filtered by checkbox siblings whose check box is checked.
Then with the array of HREFs as an object I would like to open a new browser tab for each url. The HREFs I am targeting are documents so I am filtering the href attribute with a period i.e. [href*="."] so only urls of type document will be in the array. Not necessary I guess if I can figure out how to select the urls using .sibling selectors.
So essentially the user would check boxes in a table next to a URL and then press a button which would open all the checked off urls in new tabs in the browser. (I tried to make a jsfiddle of this but their web site seems to be down at the moment). -thanks Dave
<!doctype html>
<html>
<head><script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<meta charset="utf-8">
<title>Untitled Document</title>
<script>
$(document).ready(function(){
myArray1 = $("[HREF*='.']") //I can get all the urls but how to filter by checked checkboxes?
//myArray = $(":checked").siblings(myArray1); //this didn't work for me.
var arr = $.makeArray( myArray1 ); //now arr is a js array
$(".s4-itm-btn").on("click",function(){
for ( var i = 0; i < arr.length; i++ ) {
window.location.assign( arr[ i ] ) //trying to at least open one of the URls in the array. no dice.
)};
});
</script>
</head>
<body>
<input name="goforit" type="button" class="s4-itm-btn" title="goforitt" value="goforit">
<table width="319" border="1">
<tr>
<th width="20" scope="col"> </th>
<th width="65" scope="col"> </th>
<th width="93" scope="col"> </th>
</tr>
<tr>
<td> <input type="checkbox" class="s4-itm-cbx" checked></td>
<td>asdf</td>
<td><a href="https://vaww.portal2.va.gov/sites/localresearch/Boston/ProjectManagement/24a/Conflict%20of%20Interest%20-%20Co-PI.xml" >Conflict of Interest - Co-PI</a>;</td>
</tr>
<tr>
<td><input class="s4-itm-cbx" type="checkbox"></td>
<td>asdfas</td>
<td><a href="https://vaww.portal2.va.gov/sites/localresearch/Boston/ProjectManagement/24a/Abstract.xml" >Abstract</a></td>
</tr>
</table>
</body>
</html>