setAttribute not working as it should.
Have a look at following code
function show(id){
if (document.getElementById(id).style.display == 'none')
{
document.getElementById(id).style.display = '';
document.getElementById(id).removeAttribute("disabled");
}
}
function hide(id){
document.getElementById(id).style.display = 'none';
document.getElementById(id).setAttribute("disabled","disabled");
}
http://jsfiddle.net/3jD3W/
When I hide element, i also want to disable it so that value submitted is
only for the element that visible now.
However it is not working as expected. What I am doing wrong?
No comments:
Post a Comment