嗨,我正在使用 HTML/javascript/jquery。但我在 IE 中遇到了错误。我使用的是 IE7 和 XP。
下面是代码:
$(function(){
$("select").multiselect();
var i =1;
$("select").change(function () {
var str = $(this).val();
$('.lbCriteriaContainer').html('');
$.each(str, function(index, value) {
var liTag = $('<li class="lbAlt"></li>');
var removeIcon= $('<img src="images/cross.jpg" style="cursor: pointer;width: 15px;padding-top: 3px;">');
var textElement=$('<span>'+value+'</span>');
liTag.append(removeIcon);
liTag.append(textElement);
$('.lbCriteriaContainer').append(liTag);
removeIcon.bind('click',function(){
liTag.remove();
$('select [value='+value+']').removeAttr('selected');
$('select').multiselect('refresh');
});
});
}).change();
<script type="text/javascript" src="js/jquery-1.6.js" ></script>
<link rel="stylesheet" type="text/css" href="css/jquery.multiselect.css" />
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/ui-lightness/jquery-ui.css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script src="js/jquery.multiselect.js" type="text/javascript"></script>
谢谢!