-1

I am trying to eliminate an h1 tag by replacing it with an h2 tag using jquery. Here is the code that I want to change:

<div class="player-unavailable">
<h1 class="message">An error occurred</h1>
</div>

Pretty simple, but I haven't been able to find the answer on how to target a specific h1 tag as opposed to all h1 tags on the page.

1 Answers1

0

You can target an element by its position on the page like so:

$($('h1')[idx]).replaceWith('<h2>content</h2>');

...where "idx" is the index of the h1 element.