Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- $(document).ready(
- function() {
- $('.tabs input[type="text"]').on("keyup input", function() {
- /* Get input value on change */
- var inputVal = $(this).val();
- var resultDropdown = $(this).siblings(".result");
- if (inputVal.length) {
- $.get("live-search", {
- term : inputVal
- }).done(function(result) {
- // Display the returned data in browser
- console.log(result);
- resultDropdown.html(result);
- });
- } else {
- resultDropdown.empty();
- }
- });
- // Set search input value on click of result item
- $(document).on(
- "click",
- ".result p",
- function() {
- $(this).parents(".search-box").find(
- 'input[type="text"]').val(
- $(this).text());
- $(this).parent(".result").empty();
- });
- });
- </script>
- <form class="simple-search-form">
- <div class="tabs">
- <ul>
- <li><a href="#tabs-1">All</a></li>
- <li><a href="#tabs-2">For Sale</a></li>
- <li><a href="#tabs-3">For Rent</a></li>
- </ul>
- <div id="tabs-1" class="ui-tabs-hide">
- <input type="text" autocomplete="off"
- placeholder="Enter an address or city..." /> <input
- type="submit" value="GO" />
- </div>
- <div id="tabs-2" class="ui-tabs-hide">
- <input type="text" autocomplete="off"
- placeholder="Enter an address or city..." /> <input
- type="submit" value="GO" />
- </div>
- <div id="tabs-3" class="ui-tabs-hide">
- <input type="text" autocomplete="off"
- placeholder="Enter an address or city..." /> <input
- type="submit" value="GO" />
- </div>
- </div>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement