Advertisement
wetyukmnbxc

jQuery

Apr 3rd, 2023
932
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 3.61 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>My Website</title>
  5. <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
  6. <style type="text/css">
  7. <!-- Your CSS code goes here -->
  8. <!-- ``` -->
  9.  
  10. <!-- CSS: -->
  11.  
  12. <!-- ``` -->
  13.  
  14.  
  15.  
  16. #virtualKeyboard {
  17.   display: none;
  18.   width: 100px;
  19.   height: 100px;
  20. }
  21.  
  22. #keyboardInput{
  23.   width: 850px;
  24.   height: 100px;
  25.           font-family: arial;
  26.            font-size: 72px;
  27. }
  28.  
  29. .key {
  30.   width: 120px;
  31.   height: 120px;
  32.   margin: 5px;
  33.            font-family: arial;
  34.            font-size: 96px;
  35. }
  36.  
  37. .letter {
  38.   text-transform: lowercase;
  39. }
  40.  
  41. #my-button{
  42.            font-family: Courier New;
  43.            font-size: 56px;
  44.            background-color: #F5DEB3;
  45. }
  46.  
  47. #my-paragraph{
  48.            font-family: Courier New;
  49.            font-size: 72px;
  50. }
  51. <!-- ``` -->
  52.  
  53. </style>
  54.  
  55. </head>
  56. <body>
  57.  
  58. <!-- Your HTML code here -->
  59. <p id="my-paragraph">Hello, Ronnie!</p>
  60. <p><input type="text" id="keyboardInput"></p>
  61. <div id="virtualKeyboard">
  62.   <div class="row">
  63.     <button class="key">1</button>
  64.     <button class="key">2</button>
  65.     <button class="key">3</button>
  66.     <button class="key">4</button>
  67.     <button class="key">5</button>
  68. </div>
  69. <div class="row">
  70.     <button class="key">6</button>
  71.     <button class="key">7</button>
  72.     <button class="key">8</button>
  73.     <button class="key">9</button>
  74.     <button class="key">0</button>
  75.   </div>
  76.   <div class="row">
  77.     <button class="key letter">a</button>
  78.     <button class="key letter">b</button>
  79.     <button class="key letter">c</button>
  80.     <button class="key letter">d</button>
  81.     <button class="key letter">e</button>
  82.     <button class="key letter">f</button>
  83.  </div>
  84.           <div class="row">
  85.     <button class="key letter">g</button>
  86.     <button class="key letter">h</button>
  87.     <button class="key letter">i</button>
  88.     <button class="key letter">j</button>
  89.     <button class="key letter">k</button>
  90.     <button class="key letter">l</button>
  91.  </div>
  92. <div class="row">
  93.     <button class="key letter">m</button>
  94.     <button class="key letter">n</button>
  95.     <button class="key letter">o</button>
  96.     <button class="key letter">p</button>
  97.     <button class="key letter">q</button>
  98.     <button class="key letter">r</button>
  99.  </div>
  100.  
  101.   <div class="row">
  102.     <button class="key letter">s</button>
  103.     <button class="key letter">t</button>
  104.     <button class="key letter">u</button>
  105.     <button class="key letter">v</button>
  106.     <button class="key letter">w</button>
  107.     <button class="key letter">x</button>
  108.   </div>
  109. <div class="row">
  110.     <button class="key letter">y</button>
  111.     <button class="key letter">z</button>
  112. <button id="my-button">Best Day Ever!</button>
  113.  </div>
  114.  
  115.  
  116.   <!-- add special keys like backspace, enter, shift, etc. -->
  117.  
  118. </div>
  119. <Br/>
  120.  
  121. <script>
  122.      <!-- // Your jQuery code here -->
  123. <!-- jQuery: -->
  124.  
  125. <!-- ``` -->
  126. <!-- This code creates a virtual keyboard that appears when the user clicks on an input field. When a key is clicked, its value is added to the input field. This is just a basic example and can be customized further to add more functionality and features. -->
  127. $(document).ready(function() {
  128.  
  129.   $('#keyboardInput').click(function() {
  130.     $('#virtualKeyboard').toggle();
  131.   });
  132.  
  133.   $('.key').click(function() {
  134.     var value = $(this).text();
  135.     var currentValue = $('#keyboardInput').val();
  136.     $('#keyboardInput').val(currentValue + value);
  137.   });
  138.  
  139.   $('#my-button').click(function() {
  140.     $('#my-paragraph').text("The text Ronnie typed is: " + $('#keyboardInput').val());
  141. $('#keyboardInput').val("");
  142.   });
  143.  
  144. });
  145. <!-- ``` -->
  146. </script>
  147.  
  148. </body>
  149. </html>
  150.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement