daily pastebin goal
73%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <input id="First" Placeholder="Room number" />
  2.  
  3. <input id="Second" Placeholder="Name" />
  4.  
  5.  
  6. <script>
  7. var first_input = [
  8. "first",
  9. "second",
  10. "third",
  11. "fourth",
  12. "fifth"
  13. ];
  14.  
  15. $("#First").autocomplete({
  16. source: first_input
  17. })
  18. </script>
  19.  
  20.  
  21. <script>
  22. var default_room = [
  23. "Default"
  24. ];
  25.  
  26. var first_room = [
  27. "Glory",
  28. "Dorris",
  29. "Rebecca"
  30. ];
  31.  
  32. var second_room = [
  33. "Will",
  34. "Henry",
  35. "Louie"
  36. ];
  37.  
  38. var third_room = [
  39. "Kraig",
  40. "Eddie",
  41. "Frank"
  42. ];
  43.  
  44. var fourth_room = [
  45. "David",
  46. "Rex",
  47. "Jordan"
  48. ];
  49.  
  50. var fifth_room = [
  51. "Ben",
  52. "Janet",
  53. "Cassaundra"
  54. ];
  55.  
  56.  
  57. $("#Second").autocomplete({
  58. source: default_room
  59. })
  60.  
  61.  
  62. $("#First").on("change blur", function() {
  63.  
  64. if (this.value == "first") {
  65. $("#Second").autocomplete('option', 'source', first_room)
  66. } else if (this.value == "second") {
  67. $("#Second").autocomplete('option', 'source', second_room)
  68. } else if (this.value == "third") {
  69. $("#Second").autocomplete('option', 'source', third_room)
  70. } else if (this.value == "fourth") {
  71. $("#Second").autocomplete('option', 'source', fourth_room)
  72. } else if (this.value == "fifth") {
  73. $("#Second").autocomplete('option', 'source', fifth_room)
  74. } else {
  75. $("#Second").autocomplete('option', 'source', default_room)
  76. }
  77.  
  78. /*
  79. var src_change = this.value + "_room";
  80. alert (src_change);
  81. $("#Second").autocomplete('option', 'source', src_change);
  82. */
  83.  
  84. })
  85.  
  86. </script>
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