Home Forums Porto Admin Template Toggle Switches value

  • This topic has 1 reply, 2 voices, and was last updated 2 months ago by Support2. This post has been viewed 105 times
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10030922
    mushi
    Participant

    i have table in which i used toggle switch (checkbox) i want to get its value (if check or not) of clicked row (submit button)

    Image

    HTML Code screenshot
    HTML CODE

    JScode
    JScode

    I want to get checkbox (Toggle Switches) value of that row so i can update its value in databases (0,1)
    how can i do that?



    Template Version: 2.2.0
    #10030929
    Support2
    Keymaster

    Hello,

    Here is the code you need for the updatePermissions function:

    function updatePermissions( el ) {
    	var tr = $( el ).closest('tr'),
    		values = [];
    
    	tr.find('.switch').each(function(){
    		var $checkbox = $(this).find('input'),
    			name 	  = $checkbox.attr('name');
    
    		values[ name ] = ( $checkbox.is(':checked') ) ? 1 : 0;
    	});
    
    	console.log( values );
    }

    We hope this helps.

    Kind Regards,

    Rodrigo.


Viewing 2 posts - 1 through 2 (of 2 total)