var substringMatcher = function(strs) { return function findMatches(q, cb) { var matches, substringRegex; // an array that will be populated with substring matches matches = []; // regex used to determine if a string contains the substring `q` substrRegex = new RegExp(q, 'i'); // iterate through the pool of strings and for any string that // contains the substring `q`, add it to the `matches` array $.each(strs, function(i, str) { if (substrRegex.test(str)) { matches.push(str); } }); cb(matches); }; }; var products = ['1 Gang 1 Way Metal Clad Switch 10AX','1 Gang 1 Way Switch 10AX','1 Gang 16mm Metal Back Box','1 Gang 16mm Pattress','1 Gang 16mm Pattress Box','1 Gang 2 Way 400W Dimmer Switch','1 Gang 2 Way 400w Resistive/Inductive Dimmer Switch','1 Gang 2 Way Architrave Switch 10AX','1 Gang 2 Way IP66 Weatherproof Switch','1 Gang 2 Way Metal Clad Switch 10AX','1 Gang 2 Way Switch 10AX','1 Gang 25mm Metal Back Box','1 Gang 25mm Pattress','1 Gang 25mm Pattress Box','1 Gang 35mm Deep Dry Lining Box','1 Gang 35mm Metal Back Box','1 Gang 35mm Pattress Box','1 Gang 47mm Deep Dry Lining Box','1 Gang 47mm Metal Back box','1 Gang 47mm Pattress Box','1 Gang Architrave Pattress','1 Gang Architrave Pattress Box','1 Gang Blank Plate','1 Gang CAT-5E Outlet','1 Gang Double CAT-5E Outlet','1 Gang DP Emergency Test keyswitch','1 Gang Intermediate Switch 10AX','1 Gang IP66 Weatherproof Single Socket','1 Gang Plate Single Aperture','1 Gang Plate Triple Aperture','1 Gang Plate Twin Aperture','1 Gang Stud Box','1 Gang To 2 Gang 16mm Converter Pattress Box','1+1G 35mm Dual Metal Back Box','1+2G 35mm Metal Back Box','100A 2 Pole Isolator/Main Switch','100A Connector 2 Pole','100A Fused Switch Supplied With European Fuses & Fuse Holder','10A 3 Pole Fan Isolation Switch','10A 3 Pole Fan Isolation Switch & 1G 2W Switch 10AX Combination','10A 3 Pole Pullcord Fan Isolation Switch With Neon','10A B Type Mcb','10A Mini Rcbo Type A B Curve 2 Pole (Switched Line & Neutral)','10A Rcbo Type A B Curve','10AX 2 Way Pull Switch','10W 100A Main Switch T2 Surge Protected Consumer Unit','10W Split Load T2 Surge Protected Consumer Unit Dual RCD 100A 30MA','115/230V Dual Voltage Shaver Socket','115v230V Dual Voltage Shaver Socket','11W 100A Main Switch Consumer Unit (11 Useable Ways)','11W Split Load Dual 80A 30MA RCDS Type A Consumer Unit','12W MiniGrid Module Plate','13A 1 Gang DP Switched Socket','13A 1 Gang DP Switched Socket Metal Clad','13A 1 Gang DP Switched Socket Outlet','13A 1 Gang Socket outlet Un-Switched','13A 1 Gang Un-Switched Socket','13A 2 Gang DP Outboard Switched Socket (Twin Earth)','13A 2 Gang DP Outboard Switched Socket & Neons (Twin Earth)','13A 2 Gang DP Switched Socket','13A 2 Gang DP Switched Socket Metal Clad','13A 2 Gang DP Switched Socket Outlet (Twin Earth)','13A 2 Gang SP Switched Socket','13A 2 Gang Un-Switched Socket','13A Double Pole Switched Fused Spur Metal Clad','13A Double Pole Switched Spur & Neon Metal Clad','13A DP Switched Spur','13A DP Switched Spur & Neon','13A Fused Spur','13A Fused Spur & Neon','13A Switched Fused Spur','13A Switched Fused Spur & Neon','13A Switched Fused Spur & Neon Bottom Flex Outlet','13A Switched Fused Spur Bottom Flex Outlet','13A Un-Switched Fused Spur','13A Un-Switched Fused Spur Bottom Flex Outlet','13A Un-Switched Fused Spur Metal Clad','13A Un-Switched Spur & Neon With Flex Outlet','14W 100A Main Switch T2 Surge Protected Consumer Unit','15W 100A Main Switch Consumer Unit (15 Useable Ways)','16A B Type Mcb','16A DP Pull Switch & Neon','16A Mini Rcbo Type A B Curve 2 Pole (Switched Line & Neutral)','16A Rcbo Type A B Curve','16W Split Load T2 Surge Protected Consumer Unit Dual RCD 100A 30MA','17W Split Load Dual 80A 30MA RCDS TYPE A CONSUMER uNIT','18w MiniGrid Module Plate','2 Gang 2 Way 250W Dimmer Switch','2 Gang 2 Way 250w Resistive/Inductive Dimmer Switch','2 Gang 2 Way Architrave Switch 10AX','2 Gang 2 Way IP66 Weatherproof Switch','2 Gang 2 Way Metal Clad Switch 10AX','2 Gang 2 Way Switch 10AX','2 Gang 25mm Metal Back Box','2 Gang 25mm Pattress','2 Gang 25mm Pattress Box','2 Gang 35mm Deep Dry Lining Box','2 Gang 35mm Metal Back Box','2 Gang 35mm Pattress','2 Gang 35mm Pattress Box','2 Gang 47mm Deep Dry Lining Box','2 Gang 47mm Metal Back Box','2 Gang 47mm Pattress Box','2 Gang Architrave Pattress','2 Gang Architrave Pattress Box','2 Gang Blank Plate','2 Gang Double Row K/O Box 47mm Deep','2 Gang IP66 Weatherproof Double Socket','2 Gang Plate (2+2) Aperture','2 Gang Plate (3+3) Aperture','2 Gang Plate 3 In-Line Aperture','2 Gang Plate 6 In-Line Aperture','2 Gang Stud Box','2 Gang Triple Row K/O Box 47mm Deep','20A 2P N/O 230V Installation Contactor','20A B Type Mcb','20A Double Pole Switch','20A Double Pole Switch & Neon','20A Double Pole Switch & Neon Metal Clad','20A Double Pole Switch Bottom Flex Outlet','20A Double Pole Switch Metal Clad','20A Double Pole Switch With Neon','20A DP Switch','20A Flex Outlet Plate (10mm Dia.Outlet)','20A Mini Rcbo Type A B Curve 2 Pole (Switched Line & Neutral)','20A Rcbo Type A B Curve','20W 100A Main Switch T2 Surge Protected Consumer Unit','20W Dual Tariff Dual Banked 2x100A Main Switch (10/10 Ways) Consumer Unit','21W 100A Main Switch Consumer Unit (21 Useable Ways)','21W Dual Banked 100A Main Switch T2 Surge Protected Consumer Unit (Split 10/11 Ways)','22W Dual Banked 100A Main Switch Consumer Unit (22 Useable Ways) Split 11/11 Ways','25A 4P N/O 230V Installation Contactor','25A B Type Mcb','25A Rcbo Type A B Curve','27W Split Load Dual Banked T2 Surge Protected Consumer Unit Dual RCD 100A 30MA','29W Dual Banked 100A Main Switch T2 Surge Protected Consumer Unit (Split 14/15 Ways)','2A 1 Gang Round Pin Socket','2A Round Pin Socket Outlet Un-Switched','3 Gang 2 Way 250W Dimmer SWitch','3 Gang 2 Way 250w Resistive/Inductive Dimmer Switch','3 Gang 2 Way Metal Clad Switch','3 Gang 2 Way Switch 10AX','3 Pole 10A Fan Isolator','30W Dual Banked 100A Main Switch Consumer Unit (30 Useable Ways) Split 15/15 Ways','30W Dual Tariff Dual Banked 2x100A Main Switch (15/15 Ways) Consumer Unit','32A B Type Mcb','32A Mini Rcbo Type A B Curve 2 Pole (Switched line & Neutral)','32A Rcbo Type A B Curve','3A FCU Module, DP Switch & DP Fan Switch (linked)','4 Gang 2 Way 250W Dimmer Switch','4 Gang 2 Way 250w Resistive/Inductive Dimmer Switch','4 Gang 2 Way Metal Clad Switch','4 Gang 2 Way Switch 10AX','4 Gang 2 Way Switch 10AX (On A Single Plate)','4 MOD METAL ENCLOSURE C/W EARTH & NEUTRAL TERMINAL BARS','40A 2P N/O 230V Installation Contactor','40A B Type Mcb','40A Mini Rcbo Type A B Curve 2 Pole (Switched Line & Neutral)','40A Rcbo Type A B curve','45A 1 Gang Cooker Switch & Neon','45A 1 Gang Single Cooker Outlet','45A 1 Gang Single Cooker Switch','45A 1 Gang Single Cooker Switch With Neon','45A 2 Gang Cooker Switch','45A 2 Gang Cooker Switch & Neon','45A 2 Gang Cooker Switch With Neon','45A Cooker Switch With 13A Switched Socket','45A Cooker Switch With 13A Switched Socket Outlet','45A Cooker Switch With 13A Switched Socket Outlet And Neons','45A DP 1 Gang Switch & Neon Metal Clad','45A DP 1 Gang Switch Metal Clad','45A DP 2 Gang Switch & Neon Metal Clad','45A DP 2 Gang Switch Metal Clad','45A Easyfit Dual Appliance Outlet Plate','4W 100A Main Switch Consumer Unit (4 Useable Ways)','4W RCD Incomer Consumer Unit 63A 30MA Type A','50A B Type Mcb','50A DP Pullcord Switch And Neon','50A Rcbo Type A B Curve','50A Round DP Pull Switch & Neon','5A 1 Gang Round Pin Socket','5A Round Pin Socket Outlet Un-Switched','6 Gang 2 Way Metal Clad Switch 10AX','6 Gang 2 Way Switch 10AX','6 In 1 Stud box','63A 4P N/O 230V Installation Contactor','63A B type Mcb','6A B Type Mcb','6A Mini Rcbo Type A B Curve 2 Pole (Switched Line & Neutral)','6A Rcbo Type A B Curve','6W 100A Main Switch T2 Surge Protected Consumer Unit','6w MiniGrid Module Yoke Polar White','7W 100A Main Switch Consumer Unit (7 Useable Ways)','7W RCD Incomer Consumer Unit 63A 30MA Type A','7W Split Load Dual 80A 30MA RCDS Type A Consumer Unit','Accident Report Book','Bell Transformer','CCTV System Log Book','Circular Ceiling Dry Lining Box','CONDITION REPORT INSPECTION SCHEDULE FOR 100A+ SUPPLY','D.A.D.E Dust And Debris Eliminator','Disabled Alarm Log Book','Double Plate 2+2 Aperture Metal Clad','Double Plate 3+3 Aperture Metal Clad','Double Plate 6 In-Line Aperture Metal Clad','Dual Accessory 29mm Pattress Box','Dual Pattress 29mm','Eazylink Dry Lining Box Connector','ELECT. INSTALLATION CONDITION REPORT FOR UP TO 100A SUPPLY','ELECTRICAL INSTALLATION CERTIFICATE FOR UP TO 100A SUPPLY','Electrical Installation Log Book','Emergency Lighting Log Book','EV Charger Unit (Two Pole) 100A M/S 32A (30ma 2p Rcbo Type A + SPD T2)','EV Charger Unit (Two Pole) 100A M/S 32A (30MA 2P Rcbo Type A)','EV Charger Unit (Two Pole) 100A M/S 40A (30MA 2P Rcbo Type A + SPD T2)','EV Charger Unit (Two Pole) 100A M/S 40A (30MA 2P Rcbo Type A)','Fire Alarm Log Book','FUSED SWITCH 100A 100MA Time Delayed Rcd Type A + Fuse Holder','Garage Unit 63A 30MA TYPE A RCD + 6A & 16A MCBS','Hager 10A 6kA Type B Single Pole','Hager 16A 6kA Type B Single Pole','Hager 20A 6kA Type B Single Pole','Hager 32A 6kA Type B Single Pole','Hager 40A 6kA Type B Single Pole','Hager 50A 6kA Type B Single Pole','Hager 63A 6kA Type B Single Pole','Hager 6A 6kA Type B Single Pole','Hager Cable Clamp','Hager Cable Protector Plate (5 Per Pack)','Hager Design 10 Metal 16 Way High Integrity Split Load Config 100A Sw 2*63A 30mA RCCB','Hager Design 10 Metal Consumer Unit 10 Way Split Load 5+5 100A Switch 2*63A 30mA RCCB','Hager Design 10 Metal Consumer Unit 12 Way Split Load 6+6 100A Switch 2*63A 30mA RCCB','Hager Design 10 Metal Consumer Unit 6 Way Split Load 3+3 100A Switch 2*63A 30mA RCCB','Hager Downlighter Junction box 16Amp Rated','Hager Maintenance Free Junction Box 20Amp Rated 4 Terminal','Hager Maintenance Free Junction Box 32Amp Rated 3 Terminal','Hager Single Pole Busbar Blank','IN LINE T2 SPD + 100A MAIN SWITCH IN A METAL ENCLOSURE','Installation Certificate For BS5839 Part 6','Intermediate Switch 10AX','Intruder Alarm Log Book','Isolated Satellite & Coax Point','Isolated Satellite & Coax Socket','Landlords Log Book For Mains & Battery Smoke, Heat & CO Detectors','Lock Off Kit Including Padlock (MCB, Main Switch, & Rcbo)','Master Telephone Outlet','MINOR WORKS CERTIFICATE','Module Blank Din Rail Mounted','Module Blanks Metal (6 Per Pack)','NEW INSTALLATION CERTIFICATE FOR SUPPLIES OVER 100A','Non-Isolated Satellite & Non-Isolated Coax Outlet','Non-Isolated Satellite & Non-Isolated Coax Point','Non-Isolated Satellite Outlet','Non-Isolated Satellite Point','OBSERVATION RECORD SHEET','PAT Testing Log Book','Pattress Box For PRW217','Product Name 10','Product Name 11','Product Name 14','Product Name 17','Product Name 18','Product Name 2','Product Name 20','Product Name 22','Product Name 25','Product Name 26','Product Name 27','Product Name 28','Product Name 29','Product Name 3','Product Name 30','Product Name 33','Product Name 34','Product Name 35','Product Name 36','Product Name 37','Product Name 38','Product Name 39','Product Name 40','Product Name 41','Product Name 44','Product Name 45','Product Name 47','Product Name 48','Product Name 49','Product Name 5','Product Name 50','Product Name 51','Product Name 52','Product Name 53','Product Name 54','Product Name 55','Product Name 56','Product Name 57','Product Name 58','Product Name 59','Product Name 6','Product Name 60','Product Name 7','Product Name 9','Professional Emergency Lighting Installation Certificates','Professional Installation Certificates for Fire Alarm Systems','SHEDULE OF TEST RESULTS 12 WAYS','SHEDULE OF TEST RESULTS 36 WAYS','Single Isolated Coax Point','Single Isolated Coax Socket','Single Non-Isolated Coax Point','Single Non-Isolated Coax Socket','Single Plate Single Aperture Metal Clad','Single Plate Triple Aperture Metal Clad','Single Plate Twin Aperture Metal clad','Single Telephone Outlet Master','Single Telephone Outlet Slave','Slave Telephone Outlet','T2 SPD (1 MODULE) Surge Protection Device with 32A Mcb And Cables','Tail Clamp For Live And Neutral Up To 25mm2','Tail Gland (IP68)','Time Clock Digital 7 day 1ch 150hr Reserve','Twin Isolated Coax Point','Twin Isolated Coax Socket','Twin Non-Isolated Coax Point','Twin Non-Isolated Coaxial Socket','Twin Telephone Outlet Master','Twin Telephone Outlet Slave','Vent Axia 4 Slimline Standard Extractor Fan','Vent Axia 4 Slimline Timer Extractor Fan','Vent Axia 6 Slimline Standard Extractor Fan','Vent Axia 6 Slimline Timer Extractor Fan','Wago 221-412 (100 Per Box)','Wago 221-413 (50 Per Box)','Wago 221-415 (25 Per Box)','Wago 773-102 (100 Per Box)','WagoBox Enclosure (10 Per Box)' ]; $('#our-products .typeahead').typeahead({ hint: true, highlight: true, minLength: 1 }, { name: 'products', limit: 10, source: substringMatcher(products) });