Jquery not being read properly




I am trying to make a button disabled if the checkbox is not checked in a hubspot form. Like I did here: http://jsfiddle.net/r58nfqL6/10/

I have tried a few different jquery solutions, but my code doesnt seem to be read. I have added Jquery 1.9.1 library and this is how my code is written at this moment:


Would appreciate it if someone could correct me on this ! :slight_smile:


Hi @quicklunch, can you please link the custom module that you're working on and a test page you have set up so I can take a look?



This is where the disable button code is


Hi @quicklunch, this code doesn't work because in HubSpot forms we don't append any sort of checked attribute to inputs. This code works for me in the console:

   $(".hs-button").attr("disabled", "disabled");
		$(this).attr("checked", true);
		$(".hs-button").removeAttr("disabled").css({"background" : "#55b949"});
	 } else {
		$(this).attr("checked", false);
		$(".hs-button").attr("disabled", "disabled").css({"background" : "#575757"});

That said, I wasn't able to get it to work in a custom module in your portal due to the way that we dynamically render forms. We have an onFormReady callback that would work really well with this code, but that's only available within the form embed code