I create two sets of code. Both seem the same but one is working and one is not.
http://jsfiddle.net/tM9Gu/ is not working
http://jsfiddle.net/gDxqj/ is working
Working means when you click on “other” a new textfield opens. Not working means it doesn’t.
What is the difference?
<div class="rButtons">
<input type="radio" name="numbers" value="10" onclick="uncheck();" />10
<input type="radio" name="numbers" value="20" onclick="uncheck();" />20
<input type="radio" name="numbers" value="other" onclick="check(this);"/>other
<input type="text" id="other_field" name="other_field" onblur="checktext(this);"/>
</div>
It happens because in the following fiddle you have your JavaScript code inside
onLoadmethod, which “closes” all your functions inside that method.Primitive: