Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery - Show field based on value of a type-hidden on refresh
    primarykey
    data
    text
    <p>I'm trying to create something in jQuery and having a bit of problems with it. I'm not too adept on the framework, so I'm sure this is all wrong. </p> <p>Anyways, the ultimate goal is a full form that contains 3 radio buttons - depending on the value of the button, a LI is shown. I have all of that done, but my problem is coming with validation. If something fails then the page is reloaded and the div that was selected doesn't show without clicking another radio first, then back to the original. This process is basically the same as someone came up with here. </p> <p>Here's what I got so far. </p> <p><strong>HTML</strong></p> <pre><code> &lt;li&gt; &lt;label&gt; License (radio) &lt;/label&gt; &lt;label for="commercial" class="checkBox"&gt; Commercial &lt;/label&gt; &lt;input type="radio" name="license" value="commercial" id="commercial" class="checkBox" &lt;?php echo set_radio('license', 'commercial'); ?&gt; /&gt; &lt;label for="abandonware" class="checkBox"&gt; Abandonware &lt;/label&gt; &lt;input type="radio" name="license" value="abandonware" id="abandonware" class="checkBox" &lt;?php echo set_radio('license', 'abandonware'); ?&gt; /&gt; &lt;label for="freeware" class="checkBox"&gt; Freeware &lt;/label&gt; &lt;input type="radio" name="license" value="freeware" id="freeware" class="checkBox" &lt;?php echo set_radio('license', 'freeware'); ?&gt; /&gt; &lt;/li&gt; </code></pre> <p>This is followed by three LI's that contain id="commercial, abandonware, and freeware" and class="licenseli"</p> <p>My jQuery is, as said, something from here. </p> <pre><code> $('li.licenseli').hide(); $('input[name=license]:radio').change(function(){ var Type = $(this).val(); // Get value of radio $('li.licenseli').slideUp(); // Hide non-selected $('li#'+Type).slideDown(); // Show Selected }); </code></pre> <p>So what I need help with is I have a hidden input that retrieves the value of the radio box from validation - I want to take this value (or the radio's if possible?) and have the original selected option's LI already visible. </p>
    singulars
    1. This table or related slice is empty.
    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.
    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