Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- //Close other tabs on click
- $('.ItemSearch').click(function() {
- $('input[name="Tabs"]').prop('checked', false);
- });
- //Change icon on focus and change icon back on blur
- $('#ItemSearch').focus(function(){
- $('.mdi-magnify').css('display', 'none');
- $('.mdi-pound').css('display', 'block');
- });
- $('#ItemSearch').blur(function(){
- $('.mdi-magnify').css('display', 'block');
- $('.mdi-pound').css('display', 'none');
- });
- //Called when key is pressed in text box
- $('.ItemSearch').keypress(function(e) {
- //If the letter is not digit then display error and don't type anything
- if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
- //Display error message
- $(this).attr('placeholder', 'Numbers Only');
- $(this).addClass('ItemSearchError');
- $('.mdi-pound').css('color', '#e60000');
- $('.mdi-magnify').css('color', '#e60000');
- $(this).css('border-color', '#e60000');
- $(this).css('background-color', '#ffe6e6');
- return false;
- //Reset error message after 1.25 seconds
- setTimeout(function() {
- $('.ItemSearch').attr('placeholder', 'Item Number');
- $('.ItemSearch').removeClass('ItemSearchError');
- $('.mdi-pound').css('color', '#0006ff');
- $('.mdi-magnify').css('color', '#0006ff');
- $('.ItemSearch').css('border-color', '#0006ff');
- $('.ItemSearch').css('background-color', '#e8e8ff');
- }, 1250);
- }
- });
- });
- //Search AJAX call
- function searchFilter() {
- var ItemSearch = $('#ItemSearch').val();
- var url;
- var data;
- var success;
- //If the search box [value] is empty
- if (ItemSearch == 0) {
- data = {};
- success =
- function(html) {
- $('#Loader').show(); //Show infinite scroll
- };
- } else {
- url = 'vendors/php/Filters/SearchData.php';
- data = {
- ItemSearch: ItemSearch
- };
- success =
- function(html) {
- $('#StoneContainer').html(html);
- $('#Loader').hide(); //Hide infinite scroll
- };
- }
- $.ajax({
- type: 'POST',
- url: url,
- data: data,
- success: success
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement