Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding form function to a menu
    primarykey
    data
    text
    <p>I asked this question <a href="https://stackoverflow.com/questions/8903987/input-type-hidden-functionality-issue">&lt;input type=&quot;hidden&quot; functionality issue</a> a couple of days ago and was basically told its a mess your doing it wrong and style it properly. Thing is i dont know how so ill ask the same question a different way. I ask again cause im about 10hrs into this now, and no closer to a solution. </p> <p>I want to add a form function that gets the information. Say</p> <pre><code>&lt;form action="" method="get"&gt; </code></pre> <p>My belief is i have to add an input tab somewhere to actually get the info</p> <pre><code>&lt;input type=".... </code></pre> <p>And round it off with </p> <pre><code>&lt;input type="submit" value="submit"&gt; &lt;/form&gt; </code></pre> <p>to submit it.</p> <p>How do i incorporate this into the below code to add the functionality without losing the style. I havent add style/css section as i didnt think it would it matter to the question at hand.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $(".dropdown a").click(function() { $(".dropdown ul").toggle(); }); }); $(".dropdown ul li a").click(function() { var text = $(this).html(); $(".dropdown a span").html(text); $(".dropdown ul").hide(); $("#result").html("Selected value is: " + getSelectedValue("sample")); }); function getSelectedValue(id) { return $("#" + id).find("li a span.value").html(); } $(document).bind('click', function(e) { var $clicked = $(e.target); if (! $clicked.parents().hasClass("dropdown")) $(".dropdown ul").hide(); }); }); &lt;form action="" method="get"&gt; &lt;div class="sort"&gt; &lt;ul&gt; &lt;li id="sample" class="dropdown"&gt; &lt;a href="#"&gt;Gender |&lt;span&gt;Both sexes&lt;/span&gt;&lt;/a&gt; &lt;ul&gt;&lt;li&gt;&lt;a href="#"&gt;Male&lt;span class="value"&gt;Male&lt;/span&gt;&lt;/a&gt; &lt;a href="#"&gt;Female&lt;span class="value"&gt;Female&lt;/span&gt;&lt;/a&gt; &lt;a href="#"&gt;Both Sexes&lt;span class="value"&gt;Both Sexes&lt;/span&gt;&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;input type="submit"&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload