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

151
Views
JavaScript Keyup Not Firing Sometimes

Sometimes the event can be fired but sometimes nothing happen. I have no idea why. Below is my code for .aspx and javascript. It does hit alert('register') everytime the page loads. .aspx

  <span class="searchInputContainer" data-moreresults="<%= SeeMoreText %>" data-noresult="<%= NoResultText %>">
            <asp:TextBox ID="txtSearchNew" runat="server" CssClass="SearchTextBox" UseSubmitBehaviour="false" AutoPostBack="false" MaxLength="255" EnableViewState="False" aria-label="Search"></asp:TextBox>
            <a class="dnnSearchBoxClearText" title="<%= ClearQueryText %>"></a>
        </span>


JavaScript

document.addEventListener("DOMContentLoaded", fn);
    function fn() {
        alert('fn');
        document.getElementById("<%= txtSearchNew.ClientID %>")
            .addEventListener("keyup", function (event) {
                event.preventDefault();
                if (event.keyCode === 13) {
                    alert('enter');
                    redirectNew();
                }
            });
    };
   
    function redirectNew() {
    alert('redirect');
    
        var input = document.getElementById("<%= txtSearchNew.ClientID %>").value
        var inputSplit = input.split(" ");
        var param = "";
        for (let i = 0; i < inputSplit.length; i++) {
            if (i < (inputSplit.length - 1)) {

                param += inputSplit[i] + "+";
            }
            else {
                param += inputSplit[i];
            }

        }
    alert('https://abc.local/index.php?search=' + param);
        window.open('https://abc.local/index.php?search=' + param, 'searchTab');

    }

Anyone has idea about it?

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!