If your idea would only be to swap display or hide your element using a click, what you can do is check whether it is visible or not, and hide it using is(":visible") jquery. Link with both examples.
For used would be:
$(document).ready(() => {
    $('#toca').on('click', (e) => {
      if ($('#msg-troca').is(":visible"))
        $('#msg-troca').hide();
      else
        $('#msg-troca').show();
    });
});
Now if your idea is to change the text, what you can do and define the text and check and change its content: 
$(document).ready(() => {
    $('#toca').on('click', (e) => {
      if ($('#msg-troca').text() === 'Texto 2')
        $('#msg-troca').text('Texto 1');
      else
        $('#msg-troca').text('Texto 2');
    });
});
							
							
						 
With jQuery it would just be
.click(function () {}), following the same pattern used inmouseenterandmouseleavewho do not possess theon– Woss
I tried, but it didn’t work.
– Randys Machado
You could show us what you did on a [mcve]?
– Woss