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

188
Views
Javascript function doesn't run normally with JSP

i have a JSP page run with script, the "console.log" or "alert" run normally, but function doesn't work, when i check Chrome dev tool, the id/class still retrives event listener, but it doesn't work(like onclick)

<%@ page import="entity.Product" %>
<%@ page import="entity.Category" %>
<%@ page import="java.util.List" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/Home.css" type="text/css"/>
    <link rel="stylesheet" href="css/grid.css" type="text/css"/>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css">
    <link rel="stylesheet" href="fontawesome-free-5.15.4-web/css/all.min.css" type="text/css"/>
    <link rel="stylesheet" href="css/Header.css" type="text/css"/>
    <link rel="stylesheet" href="css/Footer.css" type="text/css"/>
</head>

<script type="text/javascript">
    console.log(1); //work normally
    
    function click() { //doesn't work
        alert('home');
    }
</script>

<body>
    <div class="body" onclick="click()">
    </div>
</body>
</html>
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

The problem is fixed, you shouldn't name your function "click", it's duplicate with "onclick"

about 4 years ago · Santiago Gelvez Report
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!