CMS Development

Hubsforero
Contributor

Javascript functions in HTML inputs disappear

SOLVE

   Hi!

   I'm adding code manually to my landings (advanced-->source code), but when inserts the piece of code and save my work, the javascript functions (the events) desappair at every "input" that is having one.

 

  For example, in the next code "onkeyup" and "onchange" events were deleted:

"<input type="text" name="tasa" id="in_tasa" maxlength="9" value="0"

onkeyup="comprobarTasacion(this, hd_tasa)"
onchange="comprobarTasacion(this,hd_tasa)">"
 
 

   Why are my code being deleted??? Is there any step that i'm not following? Is my bad? Does anybody knows what's happening and can help me to solve the issue?

   Thanks in advance!

0 Upvotes
1 Accepted solution
MatthewShepherd
Solution
Key Advisor

Javascript functions in HTML inputs disappear

SOLVE

Hi @Hubsforero 

 

It could be that you are entering your code into a rich text module within your landing page, which can strip out more advanced HTML and JavaScript. You could try editing your template (I'd recommend cloning your template) and adding an HTML module to the template in the area you want to add the JavaScript code. You will need to install the HTML module in your portal first, you can do that by clicking on Marketing->Files & Templates->Hubspot marketplace (in your portal navigation), and then searching HTML. Select the HTML Module and click "Get For Free" and choose the portal to install it to.

 

Matthew Shepherd

Freelance HubSpot Consultant
CRM Consultant | SEO Specialist

Did my post help answer your query?Help the community by marking it as a solution.

View solution in original post

0 Upvotes
1 Reply 1
MatthewShepherd
Solution
Key Advisor

Javascript functions in HTML inputs disappear

SOLVE

Hi @Hubsforero 

 

It could be that you are entering your code into a rich text module within your landing page, which can strip out more advanced HTML and JavaScript. You could try editing your template (I'd recommend cloning your template) and adding an HTML module to the template in the area you want to add the JavaScript code. You will need to install the HTML module in your portal first, you can do that by clicking on Marketing->Files & Templates->Hubspot marketplace (in your portal navigation), and then searching HTML. Select the HTML Module and click "Get For Free" and choose the portal to install it to.

 

Matthew Shepherd

Freelance HubSpot Consultant
CRM Consultant | SEO Specialist

Did my post help answer your query?Help the community by marking it as a solution.
0 Upvotes