Saturday, 31 August 2013

Jquery get one or more checkbox value

Jquery get one or more checkbox value

Hello i have html table where i list database result. All database items
have self checkbox with value item id:
<td> <input type="checkbox" id="row" value="<?php echo
$this->escapeHtml($item->id);?>"> </td>
Now i want to take one or more checked item and that value to put in my
url like last param.
<a onclick="return Form.deleteItem(this);" href="<?php echo
$this->url('phonebook', array('action'=>'edit', 'id' => '1'));?>">
<?php echo $this->escapeHtml('Edit');?>
</a>
I want that add value to in url like this.
http://www.example.com/edit/1
So if user check one item and click on edit how to put that value in url
like last param
I try this but dont work:
deleteItem: function(obj) {
$('input[type=checkbox]').change(function(e){
e.preventDefault();
if ($("#row").is(':checked')) {
//read line
var queryString = $("#row").val();
// Loop
var s = $("#row").siblings();
$.each(s, function() {
// see if checked
if ($("#row").is(":checked")) {
queryString += 'OR' + $("#row").val();
}
});
console.log(queryString);
// Append to url
}
});
},

No comments:

Post a Comment