Answers for "how to convert variable to string in jquery"

2

jquery cast to string

value.toString()
String(value)
value + ""
Posted by: Guest on March-30-2020
1

convert jquery to string

var $elem = $('<a href="#">Some element</a>');
console.log("HTML is: " + $elem.get(0).outerHTML);
Posted by: Guest on May-26-2020
0

how to convert variable to string in jquery

function myFunction() {
    var y = document.getElementById("txt1").value;
    var z = document.getElementById("txt2").value;
    var x = parseInt(y) + parseInt(z);
   // document.getElementById("demo").innerHTML = x;
  document.getElementById("txt3").value= x;
  var elem = document.querySelector('#txt3');

  if(x < 50)
// Set color to purple
elem.style.color = 'red';
 else
     // Set color to purple
elem.style.color = 'green';
  }
Posted by: Guest on June-19-2021

Code answers related to "how to convert variable to string in jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language