I have a query. I need to remove all the text that follows a sign that I determine , in this case the bar . I get the string of characters from a text field and store it in a variable.
Example:
www.mipagina.com/publicaciones/favoritos
I need to delete everything that follows the first bar, leaving only:
www.mipagina.com /
I do not see it necessary to place the code that I have because it has nothing of what I consult here, but to prevent something I put it.
$('#btn').click(function() {
var url = document.getElementById('url').value;
});
I have a method in mind, and it is that somehow the chain is traversed until the first bar is detected and it continues to travel until the end, and that from the point where the first bar was detected until the end of the chain it was selected from somehow and erase, but I really have no idea how I could do this. I was consulted similar questions that have done by here but either are things of Java or are something like Delete text in quotes or Delete specific text of a string strong>. Nothing to help me then. I await your response.