Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7001577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:49:17+00:00 2026-05-27T20:49:17+00:00

I have some simple JavaScript functions: function focus(id) { var e = document.getElementById(id); if

  • 0

I have some simple JavaScript functions:

function focus(id)
{
    var e = document.getElementById(id);
    if (e != null)
    {
        e.focus();
    }
}

function show(id)
{
    var e = document.getElementById(id);
    if (e != null)
    {
        e.style.display = "inline";
    }
}

I then have an html <a> tag with an onclick event:

<a title="Click This" onclick="focus('some_textbox'); show('some_panel');">Click This</a>

When I click on the "Click This" link, only the show() method executes. From some reason the focus method is never called. Any ideas why this is happening?

I’ve tried clearing my cache and have reversed the order of the focus() and show() methods. I’ve also verified that everything is spelled correctly.

Is it because focus() is already a function within JavaScript?

Edit: I tried renaming the function to focus2 and it seems to work now. Very strange. Anybody have any insight into why this happens?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:49:18+00:00Added an answer on May 27, 2026 at 8:49 pm

    Seems like you have a renaming issue here.

    Just rename the function focus to focusX or something different, this works for me in my test case.

    Remember to update the call to focus in the href, to focusX

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some simple jQuery toggle script like this: <script type=text/javascript> $(document).ready(function() { $('#clickedit').click(function()
Here's some simple Javascript: (function($){ var ajax_callback = function(data) { window.location.hash = data.h1; };
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I have some simple javascript that as far as i can tell should work
I have some simple javascript that I'd like to run when a button is
I have a couple of fairly simple javascript functions which animate the transition of
I have some simple shell scripting tasks that I want to do For example:
I have some simple markup: <table> <tr> <td>Menu Item</td> </tr> </table> <div> <table> <tr>
i have some WinForms app (Framework to develop some simple apps), written in C#.
i have some WinForms app (Framework to develop some simple apps), written in C#.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.