我有一个带有两个隐藏字段的表单,这两个字段是根据对先前输入的答案显示的。我没有任何问题,让这些出现在一些JavaScript。但是,我无法将我的单选按钮的值插入到页面上。以下代码:
<div id="hidden-fields" style="display:none">
<div class="sixteen columns input-wrap">
<input id="delivery-instructions" name="ship_delivery_instructions" type="text" placeholder="Special delivery instructions?">
</div>
<div class="sixteen columns input-wrap">
<label>Preferred dropoff time
<input type="radio" class="radio-button" name="ship_dropoff_time" value="1">1 - 3 PM
<input type="radio" class="radio-button" name="ship_dropoff_time" value="6">6 - 8 PM
</label>
</div>
</div>
</div>结果为以下输入:
<input type="radio" class="radio-button" name="ship_dropoff_time" value>
<input type="radio" class="radio-button" name="ship_dropoff_time" value>有人知道为什么我的单选按钮值正在消失吗?
编辑:这是用于显示字段的CoffeeScript。
events:
"keyup #zip": "check_zip_code"
check_zip_code: (e) ->
currentZip = e.currentTarget.value
if eligibleZipCodes.indexOf(currentZip) == -1
@makeFieldsInvis()
else
@makeFieldsVis()
makeFieldsInvis: ->
$("#hidden-fields").css("display", "none")
$("#delivery-instructions").val("")
$(".radio-button").each(-> $(this).attr('checked', false))
makeFieldsVis: ->
$("#hidden-fields").css("display", "block")发布于 2014-09-26 01:46:29
我相信我已经找到了一个解决方案:
这是我的JSFiddle:http://jsfiddle.net/pmbbLkzk/
尝试添加结束输入标记,或自行结束输入标记:
<input [ATTRIBUTES] ></input>
<input [ATTRBITUES] />https://stackoverflow.com/questions/26044551
复制相似问题