ejecutar una funcion js con id html usando jquery
//etiqueta html
<label id="termino"></label>
//código para el js
$('#termino').on('click', function () {
console.log('Hola gracias por darme click');
});// Función externa
function muestraMensaje() {
alert('Gracias por pinchar');
}
// Asignar la función externa al elemento
document.getElementById("pinchable").onclick = muestraMensaje;
// Elemento HTML puede ser: input, button, span, a, p, label, div, etc.
<input id="pinchable" type="button" value="Pinchame y verás" />
Also in JavaScript:
- jquery set href of link
- elasticsearch aggregation unique values
- javascript convert minus to plus
- javascript dedupe array
- how to get value inside span using javascript
- react native expo change color android navigation bar
- Error: node_modules/@angular/fire/database/interfaces.d.ts:2:10
- pdfjs get all the text present
- Did you mean to use React.forwardRef()?
- passing a variable to the width style div angular
- javascript deap clone an object
- vue lifecycle
- js output html
- implement the remove property function
- new date parameters javascript
- express get request origin
- use thymeleaf variable in javascript
- display none js
- js check number of caracters
- foreach async typescript
- how to make a factorial function in javascript
- js hide element by id
- nodejs share session
- make submit button not refresh page