Saturday, August 3, 2019

javascript convert object to string

I have some form with several values depending which is selected









Now script



$(document).ready(function() {

$("#go").click(function() {

// Obtener la referencia a las listas
var lista1 = eval(document.getElementById("tropa1"));
// Obtener el valor de la opciĆ³n seleccionada
var valort1 = eval(lista1.options[lista1.selectedIndex].value);
var cadena = String(valort1);
console.log("PHP: " + String(valort1));
if (cadena.indexOf('z') != -1) {
// value selected in options does not contain 'z'
console.log("DOES NOT CONTAIN Z");
console.log(cadena);

confront(nu1, valort1, nu2, valort2)

} else {
//// value selected in options contains 'z'
console.log("CONTAINS Z");
console.log(cadena);
}
})

});


I tried to make this, but console return : [object Object] and not show string.
even using String() function or eval() to convert object to a string

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...