Q:

check what text is after certain text

I was wondering because I am making a website and I need to make JavaScript code that checks what text is going aftet certain text, I think I need to give an example, so:
A= txt

A= - the certain text that shows what text to copy, in this case the text that needs to be copied is txt
So the problem is: I don't know how to check if there is A= in the textarea and then take text as a variable txt
function formAnswer() {
    var A = document.getElementById('textarea').innerHTML = "A=";
    var ans = document.getElementById('textarea').value;

    var answer = document.getElementById('answer').innerHTML = A + 'ans';
}

This is what I've done so far, but its probably garbage, not code.

A:

You can use a regular expression.
function formAnswer() {
    var input = document.getElementById('textarea').value;
    match = input.match(/A=(.*)/);
    if (match) {
        return match[1];
    }
}

/A=(.*)/ is a regular expression that matches A= followed by anything (including an empty string). The capture group (.*) will capture everything after A=. If the input matches the pattern, match will be an array, and match[1] contains the part of the input that was captured.
If you want to requre that there be non-empty text after A=, change .* to .+.

