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

318
Views
how to change attribute "hidden" in jquery
<td>
<input id="check" type="checkbox" name="del_attachment_id[]" value="<?php echo $attachment['link'];?>">
</td>

<td id="delete" hidden="true">
the file will be deleted from the newsletter
</td>

I want to know how can i change the attribute "hidden" to false in Jquery when the checkbox is checked or not checked.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

$(':checkbox').change(function(){
    $('#delete').removeAttr('hidden');
});

Note, thanks to tip by A.Wolff, you should use removeAttr instead of setting to false. When set to false, the element will still be hidden. Therefore, removing is more effective.

over 4 years ago · Santiago Trujillo Report

0

You can use jquery attr method

$("#delete").attr("hidden",true);
over 4 years ago · Santiago Trujillo Report

0

A. Wolff was leading you in the right direction. There are several attributes where you should not be setting a string value. You must toggle it with a boolean true or false.

.attr("hidden", false) will remove the attribute the same as using .removeAttr("hidden").

.attr("hidden", "false") is incorrect and the tag remains hidden.

You should not be setting hidden, checked, selected, or several others to any string value to toggle it.

over 4 years ago · Santiago Trujillo 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!