JQuery 分割字符串

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>菜鸟教程(runoob.com)</title> 
<script src="https://cdn.staticfile.org/jquery/2.0.0/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("button").click(function(){
        var arr = \'google,stackoverflow,JavaWorld\';
        var strArray = arr.split(\',\');
        for(var i in strArray){
            alert(strArray[i]);
        }
  });
});
</script>
</head>
<body>
<h3></h3>
<button>点我</button>
</body>
</html>

菜鸟教程在线测试网址:

版权声明:本文为hgnulb原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/hgnulb/p/9762484.html