点击单选框,隐藏显示SPAN中的内容
<scripttype="text/javascript">functionselectPaytime(value){if(value==1)document.getEl...
<script type="text/javascript">
function selectPaytime(value)
{
if (value == 1)
document.getElementByID('pay1').style.display= '';
document.getElementByID('pay2').style.display= 'none';
document.getElementByID('pay3').style.display= 'none';
}
if (value == 2)
{
document.getElementByID('pay1').style.display= 'none';
document.getElementByID('pay2').style.display= '';
document.getElementByID('pay3').style.display= 'none';
}
if(value == 3)
{
document.getElementByID('pay1').style.display= 'none';
document.getElementByID('pay2').style.display= 'none';
document.getElementByID('pay3').style.display= '';
}
</script>
</head>
<body>
<ul class="check-area">
<h1 style="padding-top:5px"><p class="bt">意向参展产品种类 <i style="color:red">*</i></p></h1>
<li>
<label>
<div class="check-box-wrapper">
<input type="radio" value="1" name="class[]" checked onclick="selectPaytime(this.value)"/>
</div>
<span>家具</span>
</label>
</li>
<li>
<label>
<div class="check-box-wrapper">
<input type="radio" value="2" name="class[]" onclick="selectPaytime(this.value)"/>
</div>
<span>家居饰品</span>
</label>
</li>
<li>
<label>
<div class="check-box-wrapper">
<input type="radio" value="3" name="class[]" onclick="selectPaytime(this.value)"/>
</div>
<span>其它</span>
</label>
</li>
</ul>
<ul class="check-area">
<span id="pay1" style="display: none">
<li>
<label>
<div class="check-box-wrapper">
<input type="radio" value="700㎡以上" name="acreage[]"/>
<i class="selected-icon"></i>
</div>
<span>700㎡以上</span>
</label>
</li>
</span>
</ul>
<ul class="check-area">
<span id="pay2" style="display: none">
<li>
<label>
<div class="check-box-wrapper" >
<input type="radio" value="200㎡以上" name="acreage[]"/>
</div>
<span>200㎡以上</span></label></li>
</label>
</li>
</span>
</ul>
<ul class="check-area">
<span id="pay3" style="display: none">
<li class="other">
<label>
<div class="check-box-wrapper">
<input type="radio" value="other" name="acreage[]"/>
</div>
<span>其它</span>
<input class="other" type="text" name="acreage[other][]">
</label>
</li>
</span>
</ul>
</body>
</html>
可能我之前没表达清楚,我把span改成div了,隐藏显示以下div中的内容
<div id="pay1" style="display: none">
<label>
<input type="radio" value="700㎡以上" name="acreage[]"/>
<span>700㎡以上</span>
</label>
</div>
<div id="pay2" style="display: none">
<label>
<input type="radio" value="200㎡以上" name="acreage[]"/>
<span>200㎡以上</span></label>
</label>
</div>
<div id="pay3" style="display: none">
<label>
<input type="radio" value="other" name="acreage[]"/>
<span>其它</span>
<input class="other" type="text" name="acreage[other][]">
</label>
</div> 展开
function selectPaytime(value)
{
if (value == 1)
document.getElementByID('pay1').style.display= '';
document.getElementByID('pay2').style.display= 'none';
document.getElementByID('pay3').style.display= 'none';
}
if (value == 2)
{
document.getElementByID('pay1').style.display= 'none';
document.getElementByID('pay2').style.display= '';
document.getElementByID('pay3').style.display= 'none';
}
if(value == 3)
{
document.getElementByID('pay1').style.display= 'none';
document.getElementByID('pay2').style.display= 'none';
document.getElementByID('pay3').style.display= '';
}
</script>
</head>
<body>
<ul class="check-area">
<h1 style="padding-top:5px"><p class="bt">意向参展产品种类 <i style="color:red">*</i></p></h1>
<li>
<label>
<div class="check-box-wrapper">
<input type="radio" value="1" name="class[]" checked onclick="selectPaytime(this.value)"/>
</div>
<span>家具</span>
</label>
</li>
<li>
<label>
<div class="check-box-wrapper">
<input type="radio" value="2" name="class[]" onclick="selectPaytime(this.value)"/>
</div>
<span>家居饰品</span>
</label>
</li>
<li>
<label>
<div class="check-box-wrapper">
<input type="radio" value="3" name="class[]" onclick="selectPaytime(this.value)"/>
</div>
<span>其它</span>
</label>
</li>
</ul>
<ul class="check-area">
<span id="pay1" style="display: none">
<li>
<label>
<div class="check-box-wrapper">
<input type="radio" value="700㎡以上" name="acreage[]"/>
<i class="selected-icon"></i>
</div>
<span>700㎡以上</span>
</label>
</li>
</span>
</ul>
<ul class="check-area">
<span id="pay2" style="display: none">
<li>
<label>
<div class="check-box-wrapper" >
<input type="radio" value="200㎡以上" name="acreage[]"/>
</div>
<span>200㎡以上</span></label></li>
</label>
</li>
</span>
</ul>
<ul class="check-area">
<span id="pay3" style="display: none">
<li class="other">
<label>
<div class="check-box-wrapper">
<input type="radio" value="other" name="acreage[]"/>
</div>
<span>其它</span>
<input class="other" type="text" name="acreage[other][]">
</label>
</li>
</span>
</ul>
</body>
</html>
可能我之前没表达清楚,我把span改成div了,隐藏显示以下div中的内容
<div id="pay1" style="display: none">
<label>
<input type="radio" value="700㎡以上" name="acreage[]"/>
<span>700㎡以上</span>
</label>
</div>
<div id="pay2" style="display: none">
<label>
<input type="radio" value="200㎡以上" name="acreage[]"/>
<span>200㎡以上</span></label>
</label>
</div>
<div id="pay3" style="display: none">
<label>
<input type="radio" value="other" name="acreage[]"/>
<span>其它</span>
<input class="other" type="text" name="acreage[other][]">
</label>
</div> 展开
展开全部
<script type="text/javascript">
$(function(){
$("input[name='r1']").each(function(index){
var content = $(this).siblings("span").html();
if(content=="" || content==undefined){
$(this).siblings("span").css("display","none");//隐藏内容
$(this).css("display","none");//隐藏radio
}
})
})
</script>
下面是html,为了方便寻找给内容加上了span,不知道这样是否满足楼主要求。
<table>
<tr>
<td>
<p>
<input name="r1" type="radio" value="result1" /><span>内容1</span>
</p>
<p>
<input name="r1" type="radio" value="result2" /><span>内容1</span>
</p>
<p>
<input name="r1" type="radio" value="result3" /><span>内容1</span>
</p>
<p>
<input name="r1" type="radio" value="result4" /><span>内容1</span>
</p>
<p>
<input name="r1" type="radio" value="result5" /><span>内容1</span>
</p>
<p>
<input name="r1" type="radio" value="result6" /><span></span>
</p>
<p>
<input name="r1" type="radio" value="result7" /><span></span>
</p></td>
</tr>
</table>
$(function(){
$("input[name='r1']").each(function(index){
var content = $(this).siblings("span").html();
if(content=="" || content==undefined){
$(this).siblings("span").css("display","none");//隐藏内容
$(this).css("display","none");//隐藏radio
}
})
})
</script>
下面是html,为了方便寻找给内容加上了span,不知道这样是否满足楼主要求。
<table>
<tr>
<td>
<p>
<input name="r1" type="radio" value="result1" /><span>内容1</span>
</p>
<p>
<input name="r1" type="radio" value="result2" /><span>内容1</span>
</p>
<p>
<input name="r1" type="radio" value="result3" /><span>内容1</span>
</p>
<p>
<input name="r1" type="radio" value="result4" /><span>内容1</span>
</p>
<p>
<input name="r1" type="radio" value="result5" /><span>内容1</span>
</p>
<p>
<input name="r1" type="radio" value="result6" /><span></span>
</p>
<p>
<input name="r1" type="radio" value="result7" /><span></span>
</p></td>
</tr>
</table>
追问
可能我之前没表达清楚,我把span改为div了,我想要隐藏这些div里面的内容
700㎡以上
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询