0

So, I want my submit button to remember the checkbox input given to it.
The idea is: you check different websites and all the checked websites open on submit.
The final result should be a "bookmarkable" submit button.

The code below works fine but forgets the input as soon as you bookmark it. Is there any way I can make a submit button that would keep doing the same thing even when bookmarked?

html:

<form>
<input type="checkbox" id="site1" name="site1" value="site1">site1<br>
    <input type="checkbox" id="site2" name="site2" value="site2">site2<br>
    <input type="checkbox" id="site3" name="site3" value="site3">site3<br>
    <input type="checkbox" id="site4" name="site4" value="site4">site4
    <a href="#" onClick="validate(); return false;">Submit</a>
</form>

javascript:

function validate() {
        $(":checkbox:checked").each(function() {
        var sitename = $(this).val();
        window.open('http://www.' + sitename + '.com');
    });
    return false;
}

Thanks in advance.

Wijnand M
  • 372
  • 1
  • 3
  • 12

0 Answers0