1

How do i change Result to 'IDK MAN' in <script>

<p class="card-text">
    Result = 'Success'

    <script>
          document.body.Result.textContent = 'TEST'
    </script>
</p>
4
  • 1
    Do you want to paste your code here? Commented Dec 28, 2020 at 23:20
  • @MonsieurVolt it didn't work; it just wont work :C Commented Dec 29, 2020 at 0:01
  • @sergeykuznetsov ok Commented Dec 29, 2020 at 0:03
  • I gave you the answer Commented Dec 29, 2020 at 0:20

2 Answers 2

1

You have to select your card-text paragraph :

<script>
    document.getElementByClassName("card-text").innerHTML = "IDK MAN"
</script>
Sign up to request clarification or add additional context in comments.

Comments

0

1 - You need to communicate with tags <p>, class card-text using document.querySelector(). Like here:

let tag_p = document.querySelector('.card-text');

2 - Using textContent and the declared variable, we insert the text content instead of the current one:

tag_p.textContent = 'TEST';

If you have any questions, please let me know.

let tag_p = document.querySelector('.card-text');
tag_p.textContent = 'TEST';
<p class="card-text">
  Result = 'Success'
</p>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.