The HTML checkbox remains unchanged even after the form is submitted

On a button click, I have a form that shows and hides when the close button is clicked. Inside the form, there is an HTML checkbox. When I check the checkbox, then close the form and reopen it by clicking the button again, the checkbox remains checked, which is not the behavior I want. It should be unchecked (false) as soon as the form hides. .aspx code

</div>
 <label><input type="checkbox" name="Checkboxemail" id="ChkEmail"  style="margin-right: 9px;" value="FALSE" />I wish to be contacted regarding my feedback</label>
 </div>

 <a href="javascript:void(0);" class="close-feedback" onclick="FeedBackClose();"><i class="fa fa-times-circle"></i></a>

    function FeedBackClose() {
                debugger;
                $("#commentTextArea").val("");
                $("#TopicSelect").prop("selectedIndex", 0);
                $(".rating input:radio").removeAttr('disabled');
                $("#<%= TenantMaster_FeedbackSubmitButton.ClientID %>").removeAttr('disabled');
                $("#TopicSelect").removeAttr('disabled');
                $("#commentTextArea").removeAttr('disabled');
                $(".rating input:radio").removeAttr('disabled');
                $('#TopicSelect').parents(".form-group").removeClass("has-error");
                $('#commentTextArea').parents(".form-group").removeClass("has-error");
                $(".close-feedback").show();
                        $("div.slideFeedback").show().stop().animate({
                            "top": "-100%"
                        }, 2000);
                         $("html, body").removeClass("hide-body-scroll");
                         $("#wrapper").css("overflow", "auto");
                           $(".mask").remove();
            };

Form UI screenshot.

Answer №1

When handling the Close event, you have the option to include this code snippet to modify the value attribute.

var result = document.getElementById("ChkEmail");

  result.value = false;

Alternatively

var result = document.getElementById("ChkEmail");

   result.checked= false;

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Creating an array with conditional elements in React involves utilizing the map method along with a conditional

My array, named tableFilterFields, looks something like this: const tableFilterFields = [ { label: "Start Date", name: "StartDate", type: FilterControls.DatePicker, defaultValue: new Date(new Date().setDate( ...

Can we avoid the error callback of an AJAX request from being triggered once we have aborted the request?

Initially, I encountered a challenge where I needed to find a way to halt an AJAX request automatically if the user decided to navigate away from the page during the request. After some research, I came across this helpful solution on Stack Overflow which ...

How to use Express Validator to validate both email and username within a single field?

I am currently developing an application using the Express (Node.js framework) and I want to allow users to log in with either their email address or username. My question is, how can I implement validation for both types of input on the same field using e ...

Is there a way to automate the distribution of tasks to users in order to ensure that each user receives an equal number of assignments?

I'm in the process of developing an automated task manager that assigns tasks to users based on their role. Currently, I'm randomly selecting a user with the same role as the task from the list of users and assigning the task to them using math.r ...

Exploring JavaScript through the Lens of Object-Oriented Concepts from Java

Having spent a significant amount of time using Java, I delved into web development with GWT (Google Web Toolkit) where the convenience of having my Java object-oriented constructs translated to GWT seamlessly by Google was a major draw. While my knowledge ...

Incorporating a header include on every page throughout my website

Is there a way to include headers and footers in your HTML web pages without having to duplicate code on every page? I understand that this can be done using PHP, but what if you are creating a website solely with HTML? If there is no solution to avoid r ...

Tips for executing a Python function from JavaScript, receiving input from an HTML text box

Currently, I am facing an issue with passing input from an HTML text box to a JavaScript variable. Once the input is stored in the JavaScript variable, it needs to be passed to a Python function for execution. Can someone provide assistance with this pro ...

What is the reason the .clearfix class fails to properly clear a floated element?

Check out this post: Understanding clearfix The most helpful response indicates that the clearfix should be applied directly to the last floating element: To incorporate a clearfix, you simply need to include HTML code: <div class="clearfix"> ...

Ensure that the table is updated after every individual character input

I recently posted a question regarding how to refresh an element without refreshing the entire webpage. I've been studying ajax for some time now, but I am struggling to make it work. My goal is to dynamically update a table that primarily displays S ...

Prevent selection based on function in Angular

I'm attempting to prevent certain options from being selected based on a specific method. For instance, let's say I have four options: A B C D In my method (let's use "x" as an example): if(name == A) { disable the selection for option A. ...

Waiting for a function to finish within a nested function in JavaScript

I'm facing a simple issue that I'm struggling to solve. I have two functions and an object in JavaScript (Node.js) structured like this: var auxmap = new Map(); function one() { for(var i...) { //initialize the map and do something tw ...

Are you curious about the array of elements in React's carousel?

I'm currently in the process of constructing a website using React, and I have a specific challenge related to the "news" section. Within this section, I have a list of three components that represent different news items. These components are housed ...

Form featuring many submission buttons

Can anyone help me identify which submit button has been clicked on a form with multiple buttons? $("#my_form").on("submit", function(event) { event.preventDefault(); var form_action = $(this).attr("action"); var form_data = $(this).seri ...

Encountered an issue while attempting to load the required module

I'm having trouble setting up Stripe for my app and getting errors when trying to implement the module. Typically, I would require the module at the top of the file in order to use it, but when I do this in the paymentCtrl file, it doesn't work a ...

Configure webpack to source the JavaScript file locally instead of fetching it through HTTP

Using webpack.config.js to fetch remote js for Module Federation. plugins: [ new ModuleFederationPlugin({ remotes: { 'mfe1': "mfe1@http://xxxxxxxxxx.com/remoteEntry.js" } }) ], Is it possible to incorporate a local JS ...

Is your CSS failing to synchronize with HTML?

Greetings from MyWebsite.html! <DOCTYPE !html> <html> <head> <title>My Website</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- CSS --> <link rel="stylesheet" href="MyWebsite ...

Transfer the path of the image through an AJAX request

So, I have this form where I add an item to my database. The fields are: Name, Description, Image. I'm encountering a problem with the image field. I want to send the new values via AJAX using jQuery to my submit file in order to avoid page refreshi ...

Using the data from two input fields, an ajax request is triggered to dynamically populate the jQuery autocomplete feature

I've been struggling with this issue for quite some time now. My goal is to pass 2 arguments (the values of 2 input fields in a form) in my ajax call so I can use them for a jQuery autocomplete feature (the search is based on a MySQL query using the v ...

Utilizing Struts 2 to Manage HTTP Array Parameters through Ajax Requests

Struggling with sending array parameters to a Struts 2 action class using struts 2.1.8.1. Check out this snippet of code: public class MyAction extends ActionSupport { private String[] types; public String execute() { return SUCCESS; ...

Using JQuery to search for and remove the id number that has been clicked from a specific value

I am in need of assistance with deleting the clicked id number from an input value using jQuery. I am unsure of how to proceed with this task and would appreciate some guidance. To simplify my request, let me explain what I am trying to accomplish. Take ...