OiO.lk Blog javascript How to hide a button with multiple forms in page with Javascript
javascript

How to hide a button with multiple forms in page with Javascript


I have an e-commerce page, in the page I have multiple elements
In every form I have an .

Every form has a different name and id but every button has the same id and name.

How can I modify the visibility of the button in a specific form using the instruction in Javascript:

document.getElementById(‘addtocart’).style.visibility = ‘hidden’;

the code above modify only the first button in the page, I need to address a specific button in the page.
I can not modify the id or name of the buttons.

example:

<form name="form1" id="form1">
form content
<input type="button" name="addtocart" id="addtocart">

form content

form content

form content



You need to sign in to view this answers

Exit mobile version