Skip to content Skip to sidebar Skip to footer

Replace Var With Some New Var Jquery

I have code to find something from database and output it back if it exists. Now when I output it back I need to make on click one of those outputs replace that output as var in so

Solution 1:

Your problem is most likely because you used .html() in on a <textarea> as stated in the discussion.

https://jsfiddle.net/q9gwdLj5/

$(function(){
  $("#choices li").click(function(){
    var name = $(this).text();
    $("#ta").val($("#ta").val().replace("#thisperson", name));
  })
})

Changing the .html() bit with .val() will fix the problem.


Post a Comment for "Replace Var With Some New Var Jquery"