You are viewing limited content. For full access, please sign in.

Question

Question

How to hide a column by default?

asked on October 18, 2018

Hi all,

 

I have a Web Form with a Table.

Inside this table I have 3 columns (Description, Prestation, and Cellule).

The column "Cellule" depend of the column "Prestation" (if Interne => display : none OR if Externe => display : inline)

 

If I add a new line, the "Cellule" appear by default.

 

 

How can I hide the select by default ?

 

This is my script.

 function myscript() {
    
    $('.RadioTable tbody tr').each(function () {
      $(this).find('input:checked').each(function () {
        if ($(this).val() == "Externe"){
          	$(this).closest('tr').find('.cellule select').css("display", "inline");
        }else{
       		$(this).closest('tr').find('.cellule select').css("display", "none");
        }
      });
    });
  }

 

Thanks in advance.

Regards

0 0

Answer

SELECTED ANSWER
replied on October 18, 2018

Ok I found myselft.

 

Thank you all.

This is my script

 

  //If the user add a new line, call the function "myscript"
  $('.cf-table_parent').on('click','.cf-table-add-row',myscript);
  	

  
  function myscript() {
	$('.RadioTable tbody tr').each(function () {
    	if ($(this).find('input:checked').val() == "Externe") //If input checked = Externe
        	{
        		$(this).closest('tr').find('.cellule select').css("display", "inline"); //show select
        	}else{
       			$(this).closest('tr').find('.cellule select').css("display", "none"); //hide select
          		$(this).closest('tr').find('.cellule select').val(""); //reset select
        	}
   	});
  }

 

1 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.