2011-08-30 78 views
1

我使用jQuery-UI buttonset()函数显示/隐藏某些文本输入时遇到问题。以下是HTML:jQuery-UI:使用buttonset()显示和隐藏文本输入()

<div id="issubtitled"> 
    <input type="radio" id="unsubtitled" name="subtitled" checked="checked" /><label for="unsubtitled">No Sub-Title</label> 
    <input type="radio" id="subtitled" name="subtitled" /><label for="subtitled">With Sub-Title</label> 
</div> 
<p id="psubtitle"> 
    <label>Sub-Title: </label> 
    <input type="text" id="subtitle" name="subtitle" value="" /> 
</p> 

在这种形式下,我想在用户选择按钮集时显示并隐藏#psubtitle。请注意,我在下面的.js代码使用jQuery UI的buttonset():

var $j = jQuery.noConflict(); 
$j(document).ready(function(){ 
    $j("#psubtitle").hide(); 
    $j("#issubtitled").buttonset().click(function(){ 
     /* what should I do there? */ 
     return false; 
    }); 
}); 

回答

1

你的意思是:

$j("#psubtitle").show(); 
+0

不完全。如果我这样做后 – Andy

+0

不完全。如果我这样做,当用户按#nosubtitle时如何隐藏#psubtitle?更清楚的是,如何通过使用.each()方法“捕捉”所有输入:#issubtitled中的广播ID? – Andy