I have project here were in I need to change the default name attribute value when a link is clicked. Here's my form at the moment:
<form id="searchform" action="" method="GET">
<input id="intextbox" maxlength="150" size="20" value="" name="q" type="text" placeholder="Insert your keyword here..">
<input id="wpbdmsearchsubmit" class="submit wpbdp-button wpbdp-submit" value="Search" type="submit">
<div class="search-filter">
Search By: <a id="FilterByContinent">Continent</a> | <a id="FilterByCountry">Country</a> | <a id="FilterByFlag">Flag</a>
</div>
</form>
======================
As you can see, the default name value of my input #intextbox is q and I want to change it to listingfields[1] when the Continent link is clicked.
so from:
<input id="intextbox" maxlength="150" size="20" value="" name="q" type="text" placeholder="Insert your keyword here..">
to:
<input id="intextbox" maxlength="150" size="20" value="" name="listingfields[1]" type="text" placeholder="Insert your keyword here..">
How can I do this with JavaScript?
document.getElementById('intextbox').name = "listingfields[1]";