mercredi 25 mars 2020

How to open urls through submit of a form with checked checkbox

I want to build a form with some checkboxes. To each checkbox is bundled an url. User checks one or more checkboxes, press submit and urls of checked checkboxes open in new tabs.

I tried a snippet, which illustrates my idea, but without success:

<form>

    <label for="cb1">G</label>
    <input id="cb1" type="checkbox" onSubmit="window.open('http://google.com/','_blank')">

    <label for="cb2">Y</label>
    <input id="cb2" type="checkbox" onSubmit="window.open('http://yahoo.com/','_blank')">

    <input type="submit" value="Submit">

</form>



Aucun commentaire:

Enregistrer un commentaire