J'ai un problème, aidez-moi s'il vous plaît: Mon erreur: Uncaught NoModificationAllowedError: Impossible de définir la propriété 'innerText' sur 'HTMLElement': L'élément 'input' fait ne supporte pas l'insertion de texte. Mon code: élémentsImpossible de définir la propriété 'innerText' sur 'HTMLElement'
<div id="chatmessage">
<div id="fb-root"></div>
<script>
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/vi_VN/sdk.js#xfbml=1&version=v2.5";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div style="position:fixed; z-index:9999999; right:10px; bottom:10px;">
<div class="smallfont" style="margin-bottom:-6px">
<input onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Chat với chúng tôi'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Chat với chúng tôi'; }" style="width:250px;color: #333;font-size:16px;margin:0px;padding:7px;background-color: #4172B0;border-radius: 6px;margin-right:-10px;margin-bottom:5px;" type="button" value="Chát với chúng tôi"/>
<div style="margin: 0px; padding: 0px; border: 0px inset;">
<div style="display: none;">
<div class="fb-page" data-adapt-container-width="true" data-height="300" data-hide-cover="false" data-href="<?=$fanpage?>" data-show-facepile="true" data-show-posts="false" data-small-header="true" data-tabs="messages" data-width="250" style="position:fixed; z-index:9999999; right:0px; bottom:46px;"></div>
</div>
</div>
</div>
</div></div>
Comment puis-je résoudre ce problème? Je suis un débutant. – shinchao
Supprime toutes les mentions de 'this.innerText = '';' à partir de l'attribut 'onclick' de votre élément d'entrée. Je voudrais également vous recommander de séparer votre JavaScript et CSS de votre code HTML au lieu de les rendre des attributs. – kamoroso94
Merci pour le soutien, cette erreur n'a pas corrigé, merci kamoroso94! – shinchao