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

168
Views
Prevent Javascript caching $(document).keydown()

I have a list that I need to work with navigation buttons and after hitting enter it should run a function to execute ajax.

I load pages and my list inside (mainPage):

<div id="page_view1" class="d-none">
</div>
<div id="page_view2" class="d-none">
</div>
<div id="page_view3" class="d-none">
</div>

For every pages that should show inside another page I add it to mainPage using Javascript and when user hits cancel button I delete content of last page_view that has content.

In every page that loads is a Javascript tag when I delete all of content this tag removes too but browser caches the code and causes interference how can I prevent this.

My code that interferes event after removing from code:

    $(document).keydown(function (e) {
    
        var selectedRowIndex = table.row('.selected').index();
        switch (e.which) {
        case 38:
            if (selectedRowIndex > 0) {
                selectedRowIndex--;
                tbl2.rows().every(function (rowIdx, tableLoop, rowLoop) {
                    if (rowIdx == selectedRowIndex) {
                        this.select();
                    }
                });
            }
            break;
        case 40:
            if (selectedRowIndex < tbl2.rows().count() - 1) {
                selectedRowIndex++;
                tbl2.rows().every(function (rowIdx, tableLoop, rowLoop) {
                    if (rowIdx == selectedRowIndex) {
                        this.select();
                    }
                });
            }
            break;
        case 13:
            act_Select_1();
        case 27:
            load_last_view();
        }
    });
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!