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

276
Views
Hiding elements in HTML via JQuery, but not working

Trying to currently write a function that hides an HTML table element whenever an option is chosen on a dropdown menu. However, trying to test this doesn't seem to yield results.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js">
$(function () { 
    $(".testClass").hide();
});
</script>

And the HTML:

<div class="testClass">Test</div>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Close original the script tag used for using src, and open another one for the inline script.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js">
</script>
<script>
$(function () { 
    $(".testClass").hide();
});
</script>
</head>
<body>

<h2>Some heading</h2>
<div class="testClass">Test</div>

</body>

about 4 years ago · Juan Pablo Isaza Report

0

You are not supposed to put anything between the jquery tags.

<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>

Then create another script inside the body of your application. Here is an example from w3schools:

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").hide();
  });
});
</script>
</head>
<body>

<h2>This is a heading</h2>

<p>This is a paragraph.</p>
<p>This is another paragraph.</p>

<button>Click me</button>

</body>
</html>

The example above shows how to hide an element using jQuery with a click of a button.

However, I am not sure it is the best way to hide an element in Angular. You can do it with an example from here:

Angular 2 Show and Hide an element

Please look at gentiane answer.

about 4 years ago · Juan Pablo Isaza 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!