在IE7中无法使用jQuery选择未知属性
Can't select unknown attr's with jQuery in IE7
每次我尝试使用以下选择器选择div元素:
div#wl-add-position-steps div[data-step="1"]
IE7无法更新返回的对象。
jQuery('div#wl-add-position-steps div[data-step="1"]').hide();
jQuery('div#wl-add-position-steps div[data-step="2"]').show();
HTML: <div id="wl-add-position" style="display:none;">
<div class="wl-description">
<?php echo $this->translate('wlPositionAddDescription'); ?>
</div>
<div id="wl-add-position-steps" class="wl-steps cf">
<ul>
<li data-event-step="1" class="active"><span class="a-step"><?php echo $this->translate('stepX', 1); ?></span><?php echo $this->translate('wlPositionStep1'); ?></li>
<li data-event-step="2"><span class="a-step"><?php echo $this->translate('stepX', 2); ?></span><?php echo $this->translate('wlPositionStep2'); ?></li>
<li data-event-step="3"><span class="a-step"><?php echo $this->translate('stepX', 3); ?></span><?php echo $this->translate('wlPositionStep3'); ?>
</li>
</ul>
</div>
<div id="wl-add-position-steps">
<div data-step="1">
<input type="text" class="wl-search-full" id="wl-search-instrument" value="WKN/ISIN/Kürzel/Name" />
<ul data-block="instruments" class="wl-result-list box twoline activites"></ul>
<span data-block="nothing-found" style="display:none;">
<br /><br />
<img src="/common/img/watchlist-emptylist.png" align="center" class="search-no-warpper" />
</span>
</div>
<div data-step="2" style="display:none;">
<h3>
<?php echo $this->translate('wlPostionAddStep3Title'); ?>
</h3>
<ul data-block="quoteSources" class="wl-result-list exchanges"></ul>
</div>
<div data-step="3" style="display:none;">
<div class="modal-form-position">
<div class="cf">
<label for="wl-instrument-name"><?php echo $this->translate('value'); ?></label>
<input type="text" name="wl-instrument-name" id="wl-instrument-name" readonly value="" />
</div>
<div class="cf">
<label for="wl-quotesource-name"><?php echo $this->translate('quotesource'); ?></label>
<input type="text" name="wl-quotesource-name" id="wl-quotesource-name" readonly value="" />
</div>
<div class="cf">
<label for="wl-instrument-value"><?php echo $this->translate('buyCourse'); ?></label>
<input type="text" name="wl-instrument-value" id="wl-instrument-value" value="" />
</div>
<div class="cf">
<label for="wl-position-date"><?php echo $this->translate('date'); ?></label>
<input type="text" name="wl-position-date" id="wl-position-date" value="<?php echo date('d.m.Y'); ?>" />
</div>
<div class="cf">
<label for="wl-position-comment"><?php echo $this->translate('comment'); ?></label>
<textarea id="wl-position-comment"></textarea>
</div>
</div>
</div>
</div>
</div>
这是一个已知的问题还是另一个问题?
好,这个问题很容易解决。IE7不能直接读取元素的children()。所以选择器不能得到元素div#wl-add-position-steps>div[data-step="1"]。使用select: [data-step="1"]。问题被纠正了!
相关文章:
- 如何使用jQuery选择下拉列表的值
- 按照选项卡索引的顺序循环一个jQuery选择
- 使用Jquery选择或取消选择ListView中的所有复选框
- jQuery选择器无法正常工作
- 使用基于文本的 Jquery 选择选项
- 将jquery选择器转换为数组
- JavaScriptDOM正常工作时JQuery选择器不工作
- 在我的情况下,使用带有变量失败的 jquery 选择器
- 换行符插入jquery选择器
- 使用javascript"这个“;用于jquery选择器
- jQuery选择器缓存问题
- jQuery 选择器,所有跨度都在 DIV 内
- JQuery选择器:如果同级具有.class,则选择td
- jQuery选择器不识别任何动态创建的HTML输入函数
- 循环遍历元素jquery选择器
- jQuery选择器错误:无法识别的表达式
- 自定义jquery选择器属性未在模拟器中激发
- Jquery选择器为空,我应该使用哪个作用域
- jQuery选择JavaScript生成的元素
- Jquery选择菜单选项在页面刷新时失败