frank1 has asked for the wisdom of the Perl Monks concerning the following question:

I have the following html with onkeyup and working well in html, but when i try to parse it into perl. it doesnt work.

any way can this work

#!/usr/bin/perl -wT print "Content-type: text/html\n\n"; print <<HTML; <!DOCTYPE html> <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquer +y.min.js"></script> </head> <body> <input type="text" class="keyup-email text-input" name="7" value=""> <button type="butt +on" id="m1p" class="edBtn"> submit </b> </button> <script> \$('.keyup-email').keyup(function() { var inputVal = \$(this).val(); var emailReg = /^(?!.*_)\w+([\.-]?\w+)*@\w+([\.-]? +\w+)*(\.\w{2,3})/; if(!emailReg.test(inputVal)) { \$(".edBtn").prop("disabled", true); } else if(inputVal == 'test\@test.com') { \$(".edBtn").prop("disabled", true); }else{ \$(".edBtn").prop("disabled", false); } }); </script> </body> </html> HTML

Replies are listed 'Best First'.
Re: Onkeyup not working
by Corion (Patriarch) on Oct 07, 2023 at 14:29 UTC

    If you were using strict, Perl would tell you where you go wrong. Add the following as the second line of your script:

    use strict;

    Don't use an interpolating string then. Use a single quoted string:

    print <<'HTML';

    You forgot to escape an @.

    Also, consider using a proper template instead of inlining HTML into your code. See Template, Mojolicious::Lite or HTML::Template.

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Onkeyup not working
by haukex (Archbishop) on Oct 08, 2023 at 12:18 UTC