0

I use jquery in twig to add a variable to a textarea.

the text should be in this form: {{ variable }}

for example

$('#message').change(function(){
     var c=  $("#message option:selected").text();

// I will add this variable to the text area in the form {{ +c+ }}

    //  $('#textarea').val(c );
    });

in the picture when i clic to nom, this nom should be added to the text with {{nom}} form and not just nom I tried this code baut does not work

 $('#textarea').val("{{"+c+"}}" );

any help please

enter image description here

1

1 Answer 1

1

Solved

 $('#textarea').val( "{"+"{"+c+"}"+"}");
Sign up to request clarification or add additional context in comments.

1 Comment

Ah.. Understood. :)

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.