<sectionid="description"> Usando jQuery, você pode alterar o texto entre as tags de início e fim de um elemento. Você pode até mesmo alterar a marcação HTML. jQuery tem uma função chamada <code>.html()</code> que permite adicionar tags HTML e texto dentro de um elemento. Qualquer conteúdo anteriormente dentro do elemento será completamente substituído pelo conteúdo que você fornecer usando essa função. Aqui está como você iria reescrever e enfatizar o texto do nosso título: <code>$("h3").html("<em>jQuery Playground</em>");</code> O jQuery também possui uma função similar chamada <code>.text()</code> que apenas altera o texto sem adicionar tags. Em outras palavras, essa função não avaliará nenhuma tag HTML passada a ela, mas a tratará como o texto com o qual você deseja substituir o conteúdo existente. Altere o botão com o ID <code>target4</code> , enfatizando seu texto. Confira este <ahref="https://developer.mozilla.org/en/docs/Web/HTML/Element/em"target="_blank">link</a> para saber mais sobre a diferença entre <code><i></code> e <code><em></code> e seus usos. Observe que, embora a tag <code><i></code> tenha sido usada tradicionalmente para enfatizar o texto, ela já foi cooptada para uso como tag para ícones. A tag <code><em></code> agora é amplamente aceita como a tag para ênfase. Ou trabalharemos para este desafio. </section>
- text: Enfatize o texto no seu botão <code>target4</code> adicionando tags HTML.
testString: 'assert.isTrue((/<em>|<i>\s*#target4\s*<\/em>|<\/i>/gi).test($("#target4").html()), "Emphasize the text in your <code>target4</code> button by adding HTML tags.");'
- text: Certifique-se de que o texto permaneça inalterado.
testString: 'assert($("#target4") && $("#target4").text().trim() === "#target4", "Make sure the text is otherwise unchanged.");'
- text: Não altere nenhum outro texto.
testString: 'assert.isFalse((/<em>|<i>/gi).test($("h3").html()), "Do not alter any other text.");'
- text: Certifique-se de estar usando <code>.html()</code> e não <code>.text()</code> .
testString: 'assert(code.match(/\.html\(/g), "Make sure you are using <code>.html()</code> and not <code>.text()</code>.");'
- text: Certifique-se de selecionar o <code>button id="target4"</code> com jQuery.
testString: 'assert(code.match(/\$\(\s*?(\"|\")#target4(\"|\")\s*?\)\.html\(/), "Make sure to select <code>button id="target4"</code> with jQuery.");'