發表文章

目前顯示的是 11月, 2014的文章

[PHP] CI 分頁 第一頁的URL

http://stackoverflow.com/questions/9989494/first-page-link-issue-in-codeigniter-pagination-library $config [ 'first_url' ] = 'method/page/1' ; $this -> pagination -> initialize ( $config );

jQuery 取得表單資料、單選 Radio 與多選 Checkbox 的方法/判斷 checkbox 是否選取,實現全選跟全部取消

全部選取/取消選取 checkbox $('#check-all').bind('click',function(){ var data_check = $(this).attr('data-check'); if(data_check === "0"){ $('input[name="place_ids[]"]').prop('checked',true); $('input[name="place_ids[]"]').parent().addClass('checked'); $(this).attr('data-check',1); $(this).html('取消全選'); }else{ $('input[name="place_ids[]"]').prop('checked',false); $('input[name="place_ids[]"]').parent().removeClass('checked'); $(this).attr('data-check',0); $(this).html('全部選取'); } }); 轉自  http://blog.miniasp.com/post/2011/04/27/jQuery-get-form-value-Checkbox-Radio.aspx var cbxVehicle = new Array(); $( 'input :checkbox :checked[name="vehicle"]' ).each( function (i) { cbxVehicle[i] = this .value; }); 另一個寫法是透過  .map()  將回傳值轉譯成為另一種陣列,如下: $( 'input :checkbo