当复选框被选中时,我想显示或隐藏输入文本元素。显示/隐藏元素破坏风格
我有一个<ul>
名单和4 <li>
。第1和第3个li是复选框,第2和第4个li是文本输入。当一个复选框被选中时,jquery显示输入文本,如果未选中则隐藏。但它打破了风格。
<ul>
<li>
<input type="checkbox" id="price1" value="">
<label for="price1"><span></span>Se Vende</label>
</li>
<li class="price-1" style="display: none;">
<input type="text" placeholder="Precio de Venta"name="price[sale]" />
<span class="unit unit-2">€</span>
</li>
<li class="test">
<input type="checkbox" id="price2" value="">
<label for="price2"><span></span>Se Alquila</label>
</li>
<li class="price-2" style="display: none;">
<input type="text" placeholder="Precio de Alquiler" name="price[rent]" />
<span class="unit unit-2">€</span>
</li>
</ul>
我试图得到它的工作在这里:http://jsfiddle.net/nazu61p7/
为什么'ul {max-width:50%}'? – Streetlamp
是一款响应式设计,在我的页面中是75%。 –
尝试更新'ul li'宽度为90% – Rajesh