當複選框被選中時,我想顯示或隱藏輸入文本元素。顯示/隱藏元素破壞風格
我有一個<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