javascript - Changing property of tags using JS -


how can change property of tags using js ? i've tried these codes, doesn't work radio buttons though.

js code

obj = document.getelementbyid("personne").style; if (str[0] == 'c')     obj.disabled = false; 

html code

<input id="personne" type="radio" name="choice" value="personne" disabled /> 

here i'm trying change disabled property of radio button become enabled. please ?

try

if (str[0] === "c") {     document.getelementbyid("personne").disabled = false; } 

disabled attribute of input element, not style, accessing style property of element incorrect.

i've used strict equality comparison operators (which best practice javascript), , i've removed global you've leaked inadvertently not declaring variables var.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -