How can I eliminate repeating this function as this list of clickable buttons grows?
<p>Here is some newbie code that works but will bloat as the list grows. I'm looking for an approach that will eliminate repeating the click function bit every time a new input is created.</p>

<p>I'm creating a div as a button with a unique name, calling some values in a unique JSON file tied to that button, then storing the values in localStorage (the click will always call the same function).</p>

<p>This example deals with just three but the list could grow to dozens more.</p>

<pre><code>&lt;div style="display:none;"&gt;
&lt;input class="hiddenWebInput" id="webImportInput1" type="text" value="fooList1.txt"  /&gt;
&lt;input class="hiddenWebInput" id="webImportInput2" type="text" value="bar.txt"  /&gt;
&lt;input class="hiddenWebInput" id="webImportInput3" type="text" value="foo.txt"  /&gt;
&lt;/div&gt;

&lt;script&gt;


$("#webImport1").click(function() {

localStorage.setItem("picked", document.getElementById("webImportInput1").value);

getList();

});


$("#webImport2").click(function() {

localStorage.setItem("picked", document.getElementById("webImportInput2").value);

getList();

});


$("#webImport3").click(function() {

localStorage.setItem("picked", document.getElementById("webImportInput3").value);

getList();

});
</code></pre>

<p>The<code>getList()</code> is what I use to set other localStorage values and perform other stuff.</p>

<p>Thanks in advance for the advice!</p>
