我希望有人能幫助我解決這個簡單的問題:我剛開始學習jQuery並找到一個代碼,在選擇一個項目後顯示隱藏文本。 我想,這樣來更新它:。更新一個簡單的jQuery/CSS代碼
一)選中的項目大膽
B)我可以添加佔位符文本而不是一個空白隱藏出發的文本字段
我愚蠢地認爲我可以通過解決一):在CSS活躍的房地產,但只工作只要點擊鏈接即可。 (只要你釋放鼠標按鈕它不見了。)就像b。),這可能只有通過使用jQuery以及?如果是這樣,如果你能告訴我如何解決這個問題真的很棒。 :)
的代碼:http://jsfiddle.net/KUtY5/1/
JS
$(document).ready(function(){
$("#nav a").click(function(){
var id = $(this).attr('id');
id = id.split('_');
$("#menu_container div").hide();
$("#menu_container #menu_"+id[1]).show();
});
});
CSS
#menu_container {
width: 650px;
height: auto;
padding-left: 30px;
}
#menu_container div {
display:none;
}
HTML
<div id='nav'>
<a id="show_apps">Appetizers</a> | <a id="show_soups">Soups and Salads</a> | <a id="show_entrees">Entrees</a>
</div>
<div id="menu_container">
<div id="menu_apps">
Content of the App Section Here
</div>
<div id="menu_soups">
Content of the Soups Section Here
</div>
<div id="menu_entrees">
Content of the Entrees Section Here
</div>
</div>
我在代碼中找不到任何文本字段? –
你可能會考慮這一點,讓它做你的沉重感你已經使用jquery http://jqueryui.com/tabs/ – Bindrid