HTML button tag does not work with onclick attribute

Asked 1 years ago, Updated 1 years ago, 33 views

I have to revise the HTML written by people urgently, but I don't know the specifications or the technical background.
I don't think it's the way I was praised at this point, but I'd like to go through that for now.

HTML is

<button>foo</button>

There is a button that says, and the problem is that this button is not doing anything.
I thought I could go to google.com for now.

<!DOCTYPE html>
<html lang="ja">
<head>
<metacharset="utf-8">
<title>Test</title>
</HEAD> 
<BODY>
  <button type="button" onclick="location.href='https://google.com'">Button Test</button>
</BODY>
</HTML>

I created HTML to verify that it works properly on the same server, the same directory, and the same browser.
However, HTML with buttons that do not move

<button type="button" onclick="location.href='https://google.com'">button test</button>

When you add , the button [Button Test] appears, and when you hover your mouse, the cursor becomes finger-shaped, but when you click it, it does not jump.

I searched css with strings button and btn, but I didn't get any quick hints.
I think onclick is being suppressed somewhere, but where and how should I change it to work.
(I would be most happy if the restriction would be lifted just by the button I changed.)

Thank you for your cooperation.

javascript html

2022-09-30 17:49

1 Answers

Thank you for your help.I heard it was like this.
The screen in question was configured as follows:

[Title]
 The writing...
 The writing...

This title and sentence are switched by the UI elsewhere in HTML and vary in length.

[Title]
 The writing...
 The writing...
 The writing...
 The writing...

In , the title/text sections were all superimposed, and the switch UI made the active ones opaque and the active ones transparent.
In the case of short sentences, the buttons were covered by other long, transparent sentences and disabled.
Therefore, we rewritten the HTML so that there is only one button below the longest sentence.

[Title]
 The writing...
 The writing...
 The writing...
 The writing...
 The writing...


Depending on the title/text you are displaying, the specifications were to change the button's destination, but we decided to rewrite the link by modifying the jQuery that switches the display/hide attributes.
So it was more of a specification issue than an HTML/CSS issue.
Thank you, Sumimasen.


2022-09-30 17:49

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.