P粉1279012792023-08-18 09:53:26
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>