gpt4 book ai didi

javascript - 选择选项元素上的单击事件不起作用

转载 作者:行者123 更新时间:2023-11-30 17:03:56 28 4
gpt4 key购买 nike

<分区>

我知道我必须将 id 更改为 val 但如何???任何想法?抱歉,这对你们来说可能很容易,但对我来说不是:-)

  • 每个选项滚动到一个特定的标签,但点击不起作用

http://jsfiddle.net/9w0L7fxb/

var body = $('html, body');

$('#London').on("click", function (e) {
e.preventDefault();

body.animate({
scrollTop: slideMap.offset().top - 63
}, 'slow');

return false;
});

$("option#London").change(function () {
$(this).val();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select class="country-list">
<option value="" id="">select your city</option>
<option value="London" id="London">London</option>
<option value="CapeTown" id="CapeTown">Cape Town</option>
<option value="Beijing" id="Beijing">Beijing</option>
<option value="Tokyo" id="Tokyo">Tokyo</option>
<option value="HongKong" id="HongKong">Hong Kong</option>
<option value="KualaLumpur" id="KualaLumpur">Kuala Lumpur</option>
<option value="Singapore" id="Singapore">Singapore</option>
<option value="Mumbai" id="Mumbai">Mumbai</option>
<option value="Shanghai" id="Shanghai">Shanghai</option>
<option value="Sydney" id="Sydney">Sydney</option>
<option value="StPetersburg" id="StPetersburg">St. Petersburg</option>
<option value="SanPaulo" id="SanPaulo">São Paulo</option>
<option value="SanFrancisco" id="SanFrancisco">San Francisco</option>
<option value="Dallas" id="Dallas">Dallas</option>
<option value="NewYork" id="NewYork">New York</option>
<option value="Dubai" id="Dubai">Dubai</option>
</select>

http://jsfiddle.net/ym4frmp6/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com