1、push()将元素依次添加至数组;
2、join()将数组转换成字符串,里面可以带参数分隔符,默认【,】

<script type = text/javascript>
$(document).on('click', '.sure', function() {
var =[];
var highlights = new Array(); //或者var highlights = [];
$('.plan-ipt input').each(function(){
if($(this).val()!='')
{
highlights.push($(this).val());
}
});
var arr = highlights.join('&');  //arr是以&分割的字符串
$("#all_plan").val(arr);
})
</script>

【JS】jQuery中将数组转换成字符串join()和push()使用的更多相关文章

  1. 在Ajax中将数组转换成字符串(0517-am)

    一.如何在Ajax中将数组转换成字符串 1. 主页面; <head> <meta http-equiv="Content-Type" content=" ...

  2. js冒泡法和数组转换成字符串示例代码

    将数组转换成字符串的方法有很多,讲解下js冒泡法的使用.js代码: //js冒泡法与数据转换为字符串的例子 //整理:www.jbxue.com window.onload = function(){ ...

  3. js冒泡法和数组转换成字符串

    js代码: window.onload = function(){ var mian = document.getElementById( "mian" ); var mian1 ...

  4. JS - 字符串转换成数组,数组转换成字符串

    1.字符串转换成数组: var arr = "1, 2, 3, 4, 5, 6"; arr.split(","); // ["1",&quo ...

  5. js 中 json.stringfy()将对象、数组转换成字符串

    json.stringfy()将对象.数组转换成字符串 var student = new Object(); student.name = "Lanny"; student.ag ...

  6. 100怎么变成100.00 || undefined在数字环境下是:NaN || null在数字环境下是0 || 数组的toString()方法把每个元素变成字符串,拼在一起以逗号隔开 || 空数组转换成字符串后是什么?

    100怎么变成100.00?

  7. C#字节数组转换成字符串

    C#字节数组转换成字符串 如果还想从 System.String 类中找到方法进行字符串和字节数组之间的转换,恐怕你会失望了.为了进行这样的转换,我们不得不借助另一个类:System.Text.Enc ...

  8. 怎样把php数组转换成字符串,php implode()

    实例代码 一维数组转换成字符串代码! <?php $arr1=array("shu","zhu","1"); $c=implode(& ...

  9. Java中如何将字符串数组转换成字符串

    如果将“字符串数组”转换成“字符串”,只能通过循环,没有其他方法: public static String getExecSqlString(String str){ StringBuffer sb ...

随机推荐

  1. April Fools Day Contest 2016 G. You're a Professional

    G. You're a Professional 题目连接: http://www.codeforces.com/contest/656/problem/G Description A simple ...

  2. setTimeout递归调用跳转页面

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  3. Tasker文件夹说明

    ################导入类#################路径 类型 后缀名 /tasker/profiles/ 配置 .prf.xml /tasker/projects/ 项目 .pr ...

  4. Programmer in Google Code

    https://code.google.com/p/vsprog/ CLI program support USB_TO_XXX of Versaloon. Support AVR_ISP/JTAG, ...

  5. visual studio xcopy /exclude测试

    http://files.cnblogs.com/files/zfanlong1314/exclude%E6%B5%8B%E8%AF%95.zipxcopy 提供了 /EXCLUDE: 参数用于在复制 ...

  6. tomcat JVM内存 配置

    原文:http://elf8848.iteye.com/blog/467460 常见的内存溢出有以下两种: java.lang.OutOfMemoryError: PermGen space java ...

  7. gradle 2.1构建android出现错误的解决方案

    转自:http://www.tuicool.com/articles/YJNJbuA 使用不同版本Gradle构建Andorid 出现Gradle version xxxx is required 坑 ...

  8. jenkins中“Poll SCM”和“Build periodically”的区别

    Poll SCM:定时检查源码变更(根据SCM软件的版本号),如果有更新就checkout最新code下来,然后执行构建动作.我的配置如下: */5 * * * *  (每5分钟检查一次源码变化) B ...

  9. MySQL索引优化案例

    这里我们分成三种情况进行分析,分别是单表,两表,三表 1.单表 CREATE TABLE IF NOT EXISTS `article`( `id` ) NOT NULL PRIMARY KEY AU ...

  10. Tensorflow 之 name/variable_scope 变量管理

    name/variable_scope 的作用 充分理解 name / variable_scope TensorFlow 入门笔记 当一个神经网络比较复杂.参数比较多时,就比较需要一个比较好的方式来 ...