Jquery 生成的选择不在更改时发出火灾警报
我有一个生成的select字段,有两个选项,如下所示Jquery 生成的选择不在更改时发出火灾警报,jquery,select,alert,option,onchange,Jquery,Select,Alert,Option,Onchange,我有一个生成的select字段,有两个选项,如下所示 <div class="PlentyFormContainer"> <div class="PlentyFormContainer ArticleAttrTd_0 PlentyWebAttributeTitle">Rollen/Gleiter</div> <div class="PlentyFormContainer ArticleAttrTd_1 PlentyWebAttribute
<div class="PlentyFormContainer">
<div class="PlentyFormContainer ArticleAttrTd_0 PlentyWebAttributeTitle">Rollen/Gleiter</div>
<div class="PlentyFormContainer ArticleAttrTd_1 PlentyWebAttributeSelect">
<select onchange=" this.blur();
switchImage(this.value ,'378_0', '378', aAttribute_Image_Values_378);
priceChangeOnMarkup(this.value, '2', '0', 'price_dynamic_0_378', aAttribute_Markup_Values_378, aCurrent_Markups_378, oldPrice_378);
"
class="ArticleAttrSelect PlentyAttributeSelect_1" id="attr_row_0_378_2"
name="ArticleAttribute[0][378][53]"><option value="" class="PlentyAttributeOption">-- bitte wählen --</option><option value="1364" class="PlentyAttributeOption PlentyAttributeOption_1364">Rolle weich gebremst für harte Böden </option><option value="1363" class="PlentyAttributeOption PlentyAttributeOption_1363">Rolle hart gebremst für Teppichboden </option>
</select>
</div>
</div>
罗伦/格雷特
--比特·沃伦——罗尔·韦奇·格布雷姆斯特·弗尔·哈特·伯登·罗尔·哈特·格布雷姆斯特·弗尔·特皮克博登(Rolle weich gebremst für harte Böden Rolle hart gebremst für Teppichboden)
整个div select是由以下元素生成的:
<div class="plentyAttributeSelectWrapper">
<div class="plentyAttributeSelectWrapperTitle"><span>Rollen/Gleiter</span>
</div>
<div class="plentyAttributeSelectWrapperContent plentyAttributeSelectHasDropdown">
<div>
<div class="plentyAttributeSelectedValue">
<span class="plentyAttributeSelectedValueName">Rolle weich gebremst für harte Böden</span>
<span class="plentyAttributeSelectedValueMarkup plentyAttributeSelectValueMarkup"></span><span class="plentyAttributeSelectedArrow">
<span></span></span>
<span class="clear"></span>
</div>
<div class="plentyAttributeSelectListWrapper">
<ul>
<li>
<div class="plentyAttributeSelectValue">
<a><span class="plentyAttributeSelectValueName">Rolle hart gebremst für Teppichboden</span>
<span class="plentyAttributeSelectValueMarkup"></span></a>
</div>
</li>
<li>
<div class="plentyAttributeSelectValue">
<a><span class="plentyAttributeSelectValueName">Rolle weich gebremst für harte Böden</span>
<span class="plentyAttributeSelectValueMarkup"></span></a>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
罗伦/格雷特
罗尔·韦奇·格布雷姆斯特·弗尔·哈特·伯登
-
罗勒·哈特·格布雷姆斯特·弗尔·特皮克博登
-
罗尔·韦奇·格布雷姆斯特·弗尔·哈特·伯登
如果我试图在更改选项时强制发出警报,则不会有任何反应。生成的代码很好 它显示警报,如下所示:
也许你调用的函数,而不是发布在这里的函数,有一些内部错误,阻止你的警报出现
尝试在blur()调用之后放置警报。我尝试用jquery获取select:
$('div.PlentyFormContainer select').change(function() {
alert($(this).find('option:selected').text());
});
首先,看起来实际的选择元素上有模糊,而不是选项。这可能是你不想要的。其次,我会将blur事件处理程序移动到一个单独的js文件中,而不是像您那样将其内联。
$('div.PlentyFormContainer select').change(function() {
alert($(this).find('option:selected').text());
});