我有下面的下拉代碼和EACK不同的選擇,我想觸發我的功能之一內發射了一個JavaScript函數選項標籤
<select name="webmenu" id="webmenu">
<option value="UK" id="UK_button" title="assets/images/uk_flag.png">this is the uk</option>
<option value="US" id="US_button" title="assets/images/us_flag.png">this is the us</option>
<option value="EU" id="EU_button" title="assets/images/euro_flag.png">this is the eu</option>
</select>
我有這樣的jQuery中
$('#webmenu').change(function(){
var temp=$(this).children(":selected").val();
switch(temp)
{
case 'UK':
alert('Hello UK');
break;
case "EU":
alert("Hi EU");
break;
case "US":
alert("Hi America!");
break;
}
});
但我只想使用JavaScript。你能幫助展示如何重寫jquery代碼以獲得理想的效果嗎?
@mplungjan OP希望它不是嗎? – 2014-10-07 09:35:41