javascript - Get the href values that have a checkbox checked? -
let have similar :
<input class="checkbox_google" type="checkbox"><a href="http://fr.wikipedia.org/wiki/10_avril" onmousedown="return"><em>10</em> avril - wikipédia</a> <input class="checkbox_google" type="checkbox"><a href="http://fr.wikipedia.org/wiki/10_avril" onmousedown="return"><em>10</em> avril - wikipédia</a> <input class="checkbox_google" type="checkbox"><a href="http://fr.wikipedia.org/wiki/10_avril" onmousedown="return"><em>10</em> avril - wikipédia</a>
i href value of have checkbox checked before, if possible.
edit : developing mozilla extension, , extension should add checkbox before each link generated google search, till good, need links have checkbox checked. sorry confusion
thanks in advance.
var boxes = document.getelementsbyclassname('checkbox_google'); hrefs = []; (var i=0; i<boxes.length; i++) { if (boxes[i].checked) hrefs.push( boxes[i].nextsibling.href ); } console.log(hrefs.join(', ')); // has href valus of checked boxes
Comments
Post a Comment