Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Sep 24th, 2018 69 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. <input type="text" value="" id="ip1" class="ip1" />
  2. <input type="button" value="Add" class="bt1" id="bt1" />
  3. <br/>
  4. <select>
  5.     <option value="volvo">Volvo</option>
  6.     <option value="saab">Saab</option>
  7. </select>
  8.    
  9. $(document).ready(function (e) {
  10.     var $txtVal = $('#ip1');
  11.     $(".bt1").click(function () {
  12.         var opt = $("#ip1").val();
  13.         if ($txtVal.val()) {
  14.             $('<option />', {
  15.                 text: $txtVal.val(),
  16.                 value: $txtVal.val()
  17.             }).appendTo('select');
  18.         }
  19.     });
  20. });
  21.    
  22. <input type="text" value="" id="ip1" class="ip1" />
  23. <input type="button" value="Add" class="bt1" id="bt1" />
  24.     <br/>
  25.    <select>
  26.      <option value="volvo">Volvo</option>
  27.      <option value="saab">Saab</option>
  28.     </select>
  29.  
  30.  
  31. $(document).ready(function () {
  32.     $(".bt1").click(function () {
  33.         var opt = $("#ip1").val();
  34.         if (opt != "" && opt != " "){
  35.             opt = "<option value=" + opt + ">" + opt + "</option>";
  36.             $("select").append(opt);
  37.         }        
  38.     });
  39. });
  40.    
  41. <script type="text/javascript"        src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  42.     <script language="javascript">
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top