0
由於我們的CRM的要求,我必須處理的一個非常基本的HTML聯繫表(精簡版):可變URL通過HTML接觸形式的價值重定向
<form id="contact_form" method="POST" name="contact_form">
<p><strong>Select the white paper you would like to have:</strong></p>
<label for="paper" class="mandatory">
<span>White paper<select id="paper" name="paper" required>
<option selected="selected" value="">-Please select-</option>
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
</label>
<input id="redirect_url" type="hidden" name="redirect_url" value="" />
<input class="download" onclick="submit_form();" type="submit" value="Download" />
</form>
是否有可能寫變量由value
指定的redirect_url
?
A = 「http://example.com/a」/ B = 「http://example.com/b」 等
我應該嘗試jQuery var
或document.getElementById
?
非常基本的問題,我知道,但我最近開始對Javascript的野心。
非常感謝!我決定繼續使用jQuery,但現在我被困在if和else隊列的定義之內。寫了一個簡短函數'wp_request',用於管理'onchange'並返回所選值:'$(「form」)。wp_request(function(){('#paper')。children('option:selected') .val();'但是我無法弄清楚如何實現你的變量定義。 – nic
感謝您的指導!發表了另一個全面的解釋:https://stackoverflow.com/questions/45812619/jquery-variable-重定向換HTML接觸形式 – nic