1.jqueryåå¾çindex()为-1ï¼
2.å¦ä½ç¨jqueryè·å¾optionçç´¢å¼å¼indexï¼
jqueryåå¾çindex()为-1ï¼
odo源码æ³å¿ 楼主å页ç¾åè½ï¼ä¿®æ¹äºä¸ä¸ï¼
odo源码$(document).ready(function(){
odo源码$("b:first").addClass("active");
odo源码$("p:gt(0)").hide();
odo源码$("b").each(function(i){
odo源码$(this).click((function(k){
odo源码var _index = k;
odo源码return function(){
odo源码$("b.active").removeClass("active");
odo源码$(this).addClass("active");
odo源码$("p").hide();
odo源码$("p:eq(" + _index + ")").show();
odo源码}
odo源码})(i));
odo源码});
odo源码});
odo源码å¦ä½ç¨jqueryè·å¾optionçç´¢å¼å¼indexï¼
odo源码 éè¦åå¤çææåå«æï¼çµèãhtmlç¼è¾å¨ãæµè§å¨ãodo源码1ãé¦å ï¼æå¼htmlç¼è¾å¨ï¼æ°å»ºhtmlæ件ï¼ä¾å¦ï¼index.htmlï¼å¹¶å¼å ¥jqueryã
odo源码2ãå¨index.htmlä¸ç<script>æ ç¾ï¼è¾å ¥jquery代ç ï¼
odo源码$('select option').each(function (i) {
odo源码if ($(this).attr('selected')) {
odo源码$('body').append(i);
odo源码}
odo源码});
odo源码3ãæµè§å¨è¿è¡index.html页é¢ï¼æ¤æ¶ç¨jqueryè·åå°äºoptionçç´¢å¼å¼è¢«æå°äºåºæ¥ã
odo源码odo源码