如何解决无法在IE7中使用jQuery选择未知的属性
| 每次我尝试使用以下选择器选择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无法读取元素的直接子代()。因此选择器无法获取元素div#wl-add-position-steps> div [data-step = \“ 1 \”]。选择:[data-step = \“ 1 \”]。问题已得到纠正!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。