0
所以我有3个选择选项框。我想在第三个页面上隐藏第三个页面。出于某种原因,我的代码无法正常工作。我究竟做错了什么?在特定页面上隐藏div
HTML:
<div class="form-group">
<label class="col-md-4 control-label">First:</label>
<div class="col-md-8">
<select id="first" class="form-control">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label">Second:</label>
<div class="col-md-8">
<select id="second" class="form-control">
<option>4</option>
<option>5</option>
<option>6</option>
</select>
</div>
</div>
<div class="form-group">
<label id="thirdid" class="col-md-4 control-label">Third:</label>
<div class="col-md-8">
<select id="third" class="form-control">
<option>7</option>
<option>8</option>
<option>9</option>
</select>
</div>
脚本:
if (top.location.pathname === '/ajax/test/yes.html')
{
$("#third").hide();
$("#thirdid").hide();
}
是不是要去了'if'循环内? –
你确定它输入了oncidtion – phadaphunk
在附注中,你可以优化你的代码为'$(“#thirdid,#third”)。hide();'。你不需要单独编写它们。 –