Note that there are some explanatory texts on larger screens.

plurals
  1. POIs there a better alternative to jQuery toggle() to show/hide a text?
    primarykey
    data
    text
    <p>I'm trying to show / hide a text extention with a certain <code>.class</code> inside a form. By selecting the rodio with the correct <code>.class</code> the extention should show. When selecting any other option within the form, the extention should hide. I tried it with the jQuery toggle() function but by clicking a second time on any of the radios the extention - regardless if selected or not - shows or hides again. </p> <p>It should show only if the radio with this <code>.class</code>is selected:</p> <blockquote> <p>span class="span_home_2"</p> </blockquote> <p>The toggle() I tried it is this: </p> <p>jQuery:</p> <pre><code>$(document).ready(function(){ $("input").click(function(){ $(".span_home_2").toggle(); }); }); </code></pre> <p>HTML:</p> <pre><code>&lt;form class="banner_location_box"&gt; &lt;label class="label_head"&gt; &lt;?php echo $lang ['select_page']; ?&gt; &lt;/label&gt; &lt;br/&gt; &lt;label class="select_page"&gt; &lt;input type="radio" class="select_location" name="page_id" value="1" checked="checked"/&gt; &lt;span&gt;&lt;?php echo $lang ['home']; ?&gt;&lt;span class="span_home_2"&gt;(&lt;?php echo $lang ['available_only']; ?&gt;)&lt;/span&gt;&lt;/span&gt; &lt;/label&gt; &lt;br/&gt; &lt;label class="select_page"&gt; &lt;input type="radio" class="select_location" name="page_id" value="2"/&gt; &lt;span&gt;&lt;?php echo $lang ['business']; ?&gt;&lt;/span&gt; &lt;/label&gt; &lt;br/&gt; &lt;label class="select_page"&gt; &lt;input type="radio" class="select_location" name="page_id" value="3"/&gt; &lt;span&gt;&lt;?php echo $lang ['jobs']; ?&gt;&lt;/span&gt; &lt;/label&gt; &lt;br/&gt; &lt;/form&gt; </code></pre> <p>Is there a better way?</p>
    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