Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

219
Views
A <div> is created in JavaScript for dollar sign

I have this Razor code:

<script>
    app.run(function () {
        var key = $('#@Model.HtmlId');
        key.inputFilter(function (value) {
            return new RegExp('@Html.Raw(RegularExpressions.KeyPattern)').test(value);
        });
    });
</script>

And this is my RegularExpressions class:

public class RegularExpressions
{
    public const string KeyPattern = @"^[a-z-]+$";
    
    // other patterns
}

And what I get in my rendered HTML (page source in browser) is this:

<script>
    app.run(function () {
        var key = $('#key_Key_b13dca0421ac4740b5e177b80c002c25');
        key.inputFilter(function (value) {
            return new RegExp('^[a-z-]+$').test(value);
        });
    });
</script>

However, I get this JavaScript error in my browser console:

Uncaught SyntaxError: Invalid or unexpected token

And when I click on it, I see this code:


    app.run(function () {
        var key = $('#key_Key_5be9a1756c8549199d3b37e0eea35bba');
        key.inputFilter(function (value) {
            return new RegExp('^[a-z-]+</div>).test(value);
        });
    });

What is wrong here?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!