Change action of an action target without javascript

hmmm..I has a form with a selection field. With javascript enabled, I take a change to define the parameter values ​​as location.hrefs:

$('select').change(function(){
    window.location.href = $(this).val();
});

With javascript disabled, I have a basic form with a submit button. In order to keep track of the goals indicated in the option values, I have to set them into the action of the form. You know how I could only get the selected option as a form target, for example. with any css or sth. ?? selector The form:

<form action="test-1.html">
    <fieldset>
    <select id="lorem">
       <option value="test-1.html">test1</option>
       <option value="test-2.html">test2</option>
       <option value="test-3.html">test3</option>
    </select>
    <input type="submit" value="senden" class="submit" />
    </fieldset>
 </form>
+3
source share
1 answer

You will need to do this in the server code. Without Javascript enabled, there is no way to dynamically change anything in the HTML DOM.

, , - .

+5

All Articles