Javascript 无法使用IE7中的jQuery选择未知属性
每次尝试使用以下选择器选择div元素时:Javascript 无法使用IE7中的jQuery选择未知属性,javascript,jquery,internet-explorer-7,Javascript,Jquery,Internet Explorer 7,每次尝试使用以下选择器选择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: 这是一个已知的问题还是另一个问题 好的,这个问题很容易解决。IE7无法读
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:
这是一个已知的问题还是另一个问题
好的,这个问题很容易解决。IE7无法读取元素的直接子元素。因此选择器无法获取元素divwl add position steps>div[data step=1]。通过选择:[数据步骤=1]。问题已经纠正
你能提供你的html代码吗?不知道这是否与数据属性有关。我怀疑是这样的……还记得你可以缩短语法,而不是jQuery,只需写$I我看不出代码有任何错误,但这取决于HTML代码。。你能详细介绍一下你的HTML结构吗?这和我在JSFIDLE中假设的一样吗?
<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>