Note that there are some explanatory texts on larger screens.

plurals
  1. POjavascript to create text field with dropdown menu options
    primarykey
    data
    text
    <p>i have been using some java-script to create a text field once an certain value is selected from a drop-down box.but having a limited knowledge in java-script now that i need to edit it so a new dropdown option also creates a text field but when i have tried to edit it seems not not work.. here is the js im an trying to use</p> <pre><code>$(".claim").change(function() { $(".area").find(".field").remove(); //or $('.area').remove('.field'); if ($(this).val() == "Insurance") { $(".area").append("&lt;input class='field' name='cost' type='text' placeholder='Cost' /&gt;"); } if ($(this).val() == "Damage &amp;lt;$100") { $(".area").append("&lt;input class='field' name='cost' type='text' placeholder='Cost' /&gt;"); } }); </code></pre> <p>and here is the html dropdown box </p> <pre><code>&lt;div id="area" class="area"&gt; &lt;strong&gt;Cases:&lt;/strong&gt;&lt;input name="cases" type=text placeholder="Cases ID" maxlength="7" style="width:129px;"&gt; &lt;br /&gt; &lt;strong&gt;Claim:&lt;/strong&gt; &lt;select class="claim" id="claim" name="claim"&gt; &lt;option value=""&gt;Select a Claim&lt;/option&gt; &lt;option value="Insurance"&gt;Insurance&lt;/option&gt; &lt;option value="Warrenty"&gt;Warrenty&lt;/option&gt; &lt;option value="Damage &amp;lt;$100"&gt;Damage &amp;lt;$100&lt;/option&gt; &lt;/select&gt; </code></pre> <p></p> <p>i have attempted to edit the java-script and a few other things but none seem to work.i am guessing its something that is simple but i am unsure about using java script at this moment so any help would be great thanks </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.
    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