代码如下:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
@H_301_7@
<Meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Insert title here
for(var i = 0;i<5;i++){
$("#listproject").append("<li id=li"+i+">"+JSarray[i]+"@H_<a href="https://www.jb51.cc/tag/403/" target="_blank" class="keywords">403</a>_15@"); //在ul<a href="https://www.jb51.cc/tag/biaoqian/" target="_blank" class="keywords">标签</a>上动态<a href="https://www.jb51.cc/tag/tianjia/" target="_blank" class="keywords">添加</a>li<a href="https://www.jb51.cc/tag/biaoqian/" target="_blank" class="keywords">标签</a>
$("#li"+i).attr("class",'list-group-item'); //为li<a href="https://www.jb51.cc/tag/biaoqian/" target="_blank" class="keywords">标签</a><a href="https://www.jb51.cc/tag/tianjia/" target="_blank" class="keywords">添加</a>class<a href="https://www.jb51.cc/tag/shuxing/" target="_blank" class="keywords">属性</a>
}
$('li').on('click',function(){ //绑定事件
alert("事件绑定成功!");
});
</script>