Govi Khatri
Govi Khatri

Reputation: 15

not able to add ###Name### in textarea from jquery function

function addtext(typed) {
  var text_till = $('#ttext').html();
  switch (typed) {
    case 'name':
      var add = "###Name###";
      $('#ttext').html(add);
      break;
    default:
  }
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
  <textarea id="ttext"></textarea>
</form>
<button onclick="addtext('name')">1</button>

not able to add special symbols in textarea through function

Upvotes: 0

Views: 46

Answers (1)

Akbar Soft
Akbar Soft

Reputation: 1066

try this one please...

<form>
    <textarea id="ggg"></textarea>
</form>
<button onclick="addText('name')">1</button>

function addText(name){
        var text_till = document.getElementById("ggg").value;
        switch(name){
            case 'name':
                var add ="###Name###";
                document.getElementById("ggg").value = add;
                break;
            default:
        }
    }

Upvotes: 1

Related Questions