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 6343789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:30:50+00:00 2026-05-24T20:30:50+00:00

In short, I want to do <a href=javascript:edit(this, 123)>Edit thing</a> instead of <a href=javascript:;

  • 0

In short, I want to do

<a href="javascript:edit(this, 123)">Edit thing</a>

instead of

<a href="javascript:;" onclick="edit(this, 123)">Edit thing</a>

where this would be the <a />, and 123 is an id. Why? It’s much cleaner. Is there any way?

  • 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-24T20:30:51+00:00Added an answer on May 24, 2026 at 8:30 pm

    How about we keep things semantic?

    <button type="button" id="edit"> Edit this </button>

    and then add some javascript somewhere

    document.getElementById("edit").addEventListener("click", function(ev) {
      // do edit logic
    }, false);
    

    You’ll have issues with addEventListener in legacy browsers. Feel free to use flow to fix addEventListener

    I also recommend you read about

    • Progressive Enhancement
    • Unobtrusive JavaScript

    And choose one of those two techniques.

    Also please don’t hard code id’s into your functions like that. Your edit button should know what it’s editing by relative position in the DOM. it should be easy to find the semantic id that is on the correct element by a simple bit of DOM traversal.

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

Sidebar

Related Questions

I'll make this post short: I want to count the number of times my
In short: I want to monitor selected calls from an application to a DLL.
In short: I want to have two fullscreen views, where I can switch between
Short version: I want to trigger the Form_Load() event without making the form visible.
SHORT DESCRIPTION OF PROBLEM: I want to set the text of a searchbar without
Short version: assuming I don't want to keep the data for long, how do
I want to make a long list short by hiding some elements in long
I want to make a short URL service for 2 million assets but I
I want to display dates in the format: short day of week, short month,
I want to test whether a certain string is contained in a short list

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.