Advertisement
citstudio

Add Html Element with jQuery

Jun 4th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <script type="text/javascript" src="jquery-1.7.1.min.js"></script>
  2. <input type="radio" id="sample" name="sample" value="1" />
  3. <input type="radio" id="sample" name="sample" value="2" />
  4. <input type="radio" id="sample" name="sample" value="3" />
  5.  
  6. <script type="text/javascript">
  7. <!--
  8.     $(document).ready(function(){
  9.     $("#sample").click(function(){
  10.     if($('input[name=sample]:checked').val()=="1"){
  11.         $('<input id="ok" type="text">').appendTo('#addText');
  12.     }
  13.     });
  14.     });
  15.     function test(){
  16.         alert($("#ok").val());
  17.     }
  18. -->
  19. </script>
  20. <div id="addText"></div>
  21.  
  22. <input type="button" id="text" onclick="test();">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement