// UNCOMMENT THIS AT SHOP //require(['jquery', '$ready!'], function ($) { // Puhelinnumeron validointi if($('div#BasketAddressFormContainer, form#registrationForm').length){ $('<p class="puhelin-huomio hidden">Tarkista puhelinnumerosi muoto!</p>').insertAfter('input[name=Phone]'); var $regexname=/^(\+358|0)[\d| ]{0,10}$/; $('input[name=Phone]').on('keypress keydown keyup',function(){ if (!$(this).val().match($regexname)) { // there is a mismatch, hence show the error message $('.puhelin-huomio').removeClass('hidden'); } else{ // else, do not display message $('.puhelin-huomio').addClass('hidden'); } }); } // UNCOMMENT THIS AT SHOP //});
div#BasketAddressFormContainer p.hidden, form#registrationForm p.hidden { display: none; } div#BasketAddressFormContainer p.puhelin-huomio, form#registrationForm p.puhelin-huomio { color: red; }