jquery get textarea value code example

Example 1: get ckeditor textarea value in jquery

<textarea name="DSC" class="materialize-textarea"></textarea>
<script>
  CKEDITOR.replace('DSC');
  </script>

var desc = CKEDITOR.instances['DSC'].getData();
OR:

var desc = CKEDITOR.instances.DSC.getData();

Example 2: capture textarea value

<textarea id="myTextarea">
Hello World
</textarea>

<script>
  var x = document.getElementById("myTextarea").value;
</script>

Example 3: jquery get textarea text

$('input#mybutton').click(function() {
    var text = $('textarea#mytextarea').val();
    //send to server and process response
});

Example 4: jquery get textarea value

var message = $('textarea#message').val();

Example 5: get value of textarea jquery

$("textarea").val()

Tags:

Html Example