Hide the first element of a div
P粉278379495
P粉278379495 2023-08-17 10:45:31
0
1
443
<p>I have a div that displays this text</p> <pre class="brush:php;toolbar:false;"><address class="address address--tight"> -17.7353231,-63.1696634, Av. Block, NY00, Miami, United States </address></pre> <p>How can I hide the first two elements (coordinates) and only show the address, city and country? </p>
P粉278379495
P粉278379495

reply all(1)
P粉127901279

According to the code provided, you can directly get the element's .textContent, then .split on ,, remove the first two parts, and then Use , to .join. This method is very specific though and may fail if you are not 100% sure that you always have this order and these details.

const address = document.querySelector( 'address' );

address.textContent = address.textContent.split( ',' ).slice( 2 ).join( ',' );
<address class="address address--tight">
      -17.7353231,-63.1696634, Av. Block, NY00, Miami, United States
</address>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template