Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.23 KB | None | 0 0
  1. <script type="text/javascript">
  2. $(document).ready(
  3. function() {
  4. $('.tabs input[type="text"]').on("keyup input", function() {
  5. /* Get input value on change */
  6. var inputVal = $(this).val();
  7. var resultDropdown = $(this).siblings(".result");
  8. if (inputVal.length) {
  9. $.get("live-search", {
  10. term : inputVal
  11. }).done(function(result) {
  12. // Display the returned data in browser
  13. console.log(result);
  14. resultDropdown.html(result);
  15. });
  16. } else {
  17. resultDropdown.empty();
  18. }
  19. });
  20.  
  21. // Set search input value on click of result item
  22. $(document).on(
  23. "click",
  24. ".result p",
  25. function() {
  26. $(this).parents(".search-box").find(
  27. 'input[type="text"]').val(
  28. $(this).text());
  29. $(this).parent(".result").empty();
  30. });
  31. });
  32. </script>
  33.  
  34. <form class="simple-search-form">
  35. <div class="tabs">
  36. <ul>
  37. <li><a href="#tabs-1">All</a></li>
  38. <li><a href="#tabs-2">For Sale</a></li>
  39. <li><a href="#tabs-3">For Rent</a></li>
  40. </ul>
  41. <div id="tabs-1" class="ui-tabs-hide">
  42. <input type="text" autocomplete="off"
  43. placeholder="Enter an address or city..." /> <input
  44. type="submit" value="GO" />
  45. </div>
  46. <div id="tabs-2" class="ui-tabs-hide">
  47. <input type="text" autocomplete="off"
  48. placeholder="Enter an address or city..." /> <input
  49. type="submit" value="GO" />
  50. </div>
  51. <div id="tabs-3" class="ui-tabs-hide">
  52. <input type="text" autocomplete="off"
  53. placeholder="Enter an address or city..." /> <input
  54. type="submit" value="GO" />
  55. </div>
  56. </div>
  57. </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement