@Braulio_Barrera I didn’t receive any errors when running this code but it didn’t seem to fully to your intended effect. Are you still hitting an error with that code? One interesting think i ran into was that it seemed you were trying to remove from an already empty array.
$('form.hs-form > div.recaptcha')//I added this to check it before the remove
[]
$('form.hs-form > div.recaptcha').remove()
[]
$('form.hs-form > div.hs_submit').remove();
[]
$('form.hs-form > fieldset').remove();
[]
@Braulio_Barrera Have you tried building the form out in the console in chrome? That way you can test your code out to make sure it is doing what you want or expect before trying to run it all at once and hitting the catch all error. There seem to be some logic issues if you are trying to remove items that aren’t even there.
@Braulio_Barrera build out your code using the Chrome console line by line. This will allow you to see what line of code is throwing the error as well as the status of all your divs that you are adding. Your code is to complicated to run everything all at once. Let me know if you are running into an issue on similar lines of code as me.
When i tried to move those elements in to my section the code breaks and the fieldset that i was trying to remove I did it from the HubSpot form creating tool and the problem was fixed!
@Braulio_Barrera are you loading the hubspot script before you make the hbst call? Also the hbspt.forms.create is leveraging just JavaScript. The JQuery is used to manipulate it once it is created.
@pmanca yes i’m loading the script before the hbst call! Before I’ve been working with the normal form module and is working fine, but i need to add some features and jQuery is the only way to do it and reading the link that i posted on this topic that was the way to do it using the onFormReady but the problem is when i submit the form! Not working at all!
I’m trying to create the required structure to the form, taking all the fieldsets and wrap it into a new section html element that I create with jQuery! That’s the behavior that i want to do, everything works great the function meets the requirements but the problem is when I click on submit button not work at all!
any chance you can get the full error. Looks like you are running your files through a minified tool. Which is good for creating light weight source files but terrible for troubleshooting.