javascript - Close button not working in firefox -
i'm trying design search button. close button working fine in browsers except firefox. have no clue why happening. there other alternative way achieve this?
(function($) { $.fn.searchbox = function(ev) { var $searchel = $(".search-elem"); var $placeholder = $(".placeholder"); var $sfield = $("#search-field"); if (ev === "open") { $searchel.addclass("search-open"); } if (ev === "close") { $searchel.removeclass("search-open"), $placeholder.removeclass( "move-up" ), $sfield.val(""); } var movetext = function() { $placeholder.addclass("move-up"); }; $sfield.focus(movetext); $placeholder.on("click", movetext); $(".submit").prop("disabled", true); $("#search-field").keyup(function() { if ($(this).val() != "") { $(".submit").prop("disabled", false); } }); }; })(jquery); $(".search-btn").on("click", function(e) { $(this).searchbox("open"); e.preventdefault(); }); $(".close").on("click", function() { $(this).searchbox("close"); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="searchdiv"> <a href="#" class="search-btn"><i class="fa fa-search"></i></a> <div class="search-box search-elem"> <button class="close"> x </button> <div class="inner row"> <div class="small-12 columns"> <label class="placeholder" for="search-field">enter search key...</label> <input type="text" id="search-field"> <button class="submit" type="submit">submit</button> </div> </div> </div> </div>
just tried same in firefox, , found jquery lib not downloaded firefox if i'm using jquery cdn. solution this: download jquery , save on server , access jquery lib server.
Comments
Post a Comment