Breaking News

JQuery .prop() on click checked > false


I have a form with checkboxes which generates a new block displaying the color filters selected by the user.


In this new block, I made a click event which removes the selected filter with the “.buttonRemoveFilter” button.

I try to uncheck the checkbox in conjunction with the filter but I can only uncheck all the checkboxes.

$(document).on("click", ".buttonRemoveFilter", function(){

     $("[id^=branche_search_form_couleurs_").prop("checked", false);

I try to do, that when I remove a filter from the new block, it unchecks the color checkbox related to this filter.

New block

How to&Answer:

Add a way of knowing which filter you have clicked – if you want to remove BLANC filter, check that the user has clicked BLANC filter type. Then access checkbox input by using


Something like this:

$(document).on("click", ".buttonRemoveFilter", function(){
     let clickedFilterType = $(this).attr("data-type");
     $("input[value='"+clickedFilterType+"']").prop("checked", false);



Try these options.

In your form add a common class to your input checkbox (let’s say the class name is “.chxbox”)

Then use this jQuery function

         id = $(this).attr('id');

About rankhawks

Check Also

jquery – How to remove all item from json and get empty object

Questions: I am using jquery to manage dynamic list of objects. var data = []; …

jquery – Why does option refuse to append to select element?

Questions: Closed. This question is off-topic. It is not currently accepting answers. I’m trying to …

jquery – Detect Changes to Iframe Content

Questions: if it possible tell if an Iframe content has changed after the page has …

jquery – Creating fullpage.js wrapper in a normal flow/scrolling page, removing fullpage.js scrollbar

Questions: As the title suggests, I wish to know is there a possbility of creating …

Problem with two div droppables when drag element (Jquery Ui)

Questions: I have a problem with Jquery Ui Droppable. I have two div droppables inside …

Leave a Reply

Your email address will not be published. Required fields are marked *