Copy link to clipboard
Copied
hola, estoy creando un pequeño proyecto, pero quiero saber como obtener el valor ingresado en un componente Input? este es mi código, pero no consigo como hacer que funcione.
this.stop();
this.textoEjemplo;
this.obtenerValor.on("click", function(){
console.log($(root.texoEjemplo).value());
});
try:
this.obtenerValor.addEventListener('click', clickF);
function clickF(){
textoExjemploF(this);
});
function textoEjemploF(tl) {
if(tl.textoEjemplo.value == 10){
console.log(tl.textoEjemplo.value);
}else{
console.log("no es igual");
}
}
Copy link to clipboard
Copied
use:
this.stop ();
this.textoEjemplo;
this.obtenerValor.on ("click", function() {}
Console.log ($(#texoEjemplo) .val ()); // assuming texoExjemplo is in the current scope/context
});
Copy link to clipboard
Copied
Hi, your answer generate an error in the print Console.log ($(#texoEjemplo) .val ());
Copy link to clipboard
Copied
that should be console.log
Copy link to clipboard
Copied
yes, but the problem is this simbol # in console.log ($(#texoEjemplo) .val ());
There the error is generated.
I have this code,
if(!this.textoEjemplo_change_cbk) {//(textoEjemplo_change_cbk), I don't know what will be this
function textoEjemplo_change(evt) {
if(evt.target.value == 10){
console.log(evt.target.value);
}else{
console.log("no es igual");
}
}
$("#dom_overlay_container").on("change", "#textoEjemplo", textoEjemplo_change.bind(this));
this.textoEjemplo_change_cbk = true;
}
For get the value of Input, but I don't want use this code, I want implement in a button, for be executed when clicked and not enter.
Copy link to clipboard
Copied
let's try that again,
function ti_change(e) {
console.log(e.target.value);
}
$("#dom_overlay_container").on("change", "#texoEjemplo", ti_change.bind(this));
Copy link to clipboard
Copied
Ok friend, I'm sorry, I didn't understand me, I want implement this code in a button for be executed when I press the button. for this I have this code.
//Here I get this value of the input, but I want implement a button for executed this code doing click and not pressing enter key
this.obtenerValor.on("click", function(){
function textoEjemplo_change(evt) {
if(evt.target.value == 10){
console.log(evt.target.value);
}else{
console.log("no es igual");
}
}
$("#dom_overlay_container").on("change", "#textoEjemplo", textoEjemplo_change.bind(this));
});
but doesn't run when clicked, only is executed when is pressed the enter key
function ti_change(e) {
console.log(e.target.value);
}
$("#dom_overlay_container").on("change", "#texoEjemplo", ti_change.bind(this));
this code only is executed when is pressed the enter key, I don't want that
Copy link to clipboard
Copied
try:
this.obtenerValor.addEventListener('click', clickF);
function clickF(){
textoExjemploF(this);
});
function textoEjemploF(tl) {
if(tl.textoEjemplo.value == 10){
console.log(tl.textoEjemplo.value);
}else{
console.log("no es igual");
}
}
Copy link to clipboard
Copied
thanks, kglad.com. you are genial
Copy link to clipboard
Copied
you're welcome.