very basic question; I bet it was already asked here but really couldn't find it.
okay so I have a little html form with a hidden input:
<input type='hidden' id='switchtonew' name='new' value='no'>
and a button that shall change the value of my hidden input to 'yes', via a function because its doing a couple more things, but these work...:
<button onclick='maneu()'>switch</button>
and the function:
function maneu(){
[...]
document.getElementById('switchtonew').value = 'yes';
}
and now if you click the button, the value of my hidden input just vanishes.
why?
I did try element.setAttribute('value', 'yes'); too.
Im really confused, please help :(
EDIT: changed function name to real, used one. still not working.
switchis a reserved keyword. Try using another name for your function.deleteorclass.