---
title: "jquery取checkbox中被选中的值"
author: "pengpd"
date: "2012-09-09T16:48:52Z"
tags: []
slug: "jquery-checkbox"
draft: false
lastmod: "2012-09-09T16:48:52Z"
id: 1674579
url: "https://pengpd.iteye.com/blog/1674579"
---

```java
	function vote(){
		
				  var checks = "";
   				 $("input[name='options']").each(function(i){
			        if($(this).attr("checked") == "checked"){
			        	
			            checks += $(this).val() + "|";            //动态拼取选中的checkbox的值，用“|”符号分隔
			        	
			        }
			       
			    })  ; 
			  alert(checks);

```