Scroll button after swapping css with Jquery

Asked

Viewed 65 times

1

I have the following input:

inserir a descrição da imagem aqui

When you click the change button a new input appears:

inserir a descrição da imagem aqui

When you click this remove button, the first input appears again, only the button breaks the line and looks like this:

inserir a descrição da imagem aqui

Here’s the script behind it:

<script>
   $(document).ready(function(){      
        $("#edita,#remove").click(function(){

      var id = $(this).attr('id');

      if(id=='edita'){
        $('#numero').css("display","none");
        $('#edita').css("display","none");
        $('#trocaNum').css("display","block");
      }
      if(id=='remove'){
        $('#numero').css("display","block");
        $('#edita').css("display","inline");
        $('#trocaNum').css("display","none"); 
      }

    });        
  });
</script>

Suggestions ?

  • 1

    You can post HTML?

  • 1

    Swap $('#numero'). css("display","block"); for $('#numero'). css("display","");

  • @Rboschini worked. If you want to reply to me to mark as solved. Alias this script is good? or I have to do something more optimized.

  • @Bia already posted, thanks for the kindness.

1 answer

1


Exchange the

$('#numero').css("display","block"); 

for

$('#numero').css("display","");

That should do it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.