Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- $(document).ready(function() {
- $("form.form p.submit input").prop( "disabled", true );
- $('.phone input.text').on("click", function() {
- if( !$(this).val() ) {
- $(this).val("+36");
- }
- });
- $('.phone input.text').keyup(function(e) {
- var a = $(this).val();
- var filter = /^([+]\d{10})/;
- var errorbox = $("#error_for_" + $(".phone input.text").attr("id"));
- if(a.length < 11){
- $("form.form p.submit input").prop( "disabled", true );
- }
- if(a.match(filter)) {
- if(a.length >= 11 && a.length < 14){
- errorbox.hide();
- $('.phone input.text').css("color", "#666");
- $("form.form p.submit input").prop( "disabled", false );
- } else {
- errorbox.show();
- errorbox.addClass("telefonhiba");
- errorbox.html('Kérjük, hogy a telefonszámot ilyen formátumban adja meg: +36123456789');
- errorbox.css({
- 'color' : '#f36',
- 'width' : '100%',
- 'float' : 'right',
- 'position' : 'relative',
- 'top' : '-35px',
- 'line-height' : '1.4',
- 'margin-left' : '35px',
- 'max-width' : '48%',
- 'left' : '0'
- });
- $('.phone input.text').css("color", "red");
- $("form.form p.submit input").prop( "disabled", true );
- }
- } else {
- errorbox.show();
- errorbox.addClass("telefonhiba");
- errorbox.html('Kérjük, hogy a telefonszámot ilyen formátumban adja meg: +36123456789');
- errorbox.css({
- 'color' : '#f36',
- 'width' : '100%',
- 'float' : 'right',
- 'position' : 'relative',
- 'top' : '-35px',
- 'line-height' : '1.4',
- 'margin-left' : '35px',
- 'max-width' : '48%',
- 'left' : '0'
- });
- $('.phone input.text').css("color", "red");
- $("form.form p.submit input").prop( "disabled", true );
- }
- });
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement