This is a test forum with a static import from forum.open.mp it will not be automatically synchronised so any posts you make here will be lost when we migrate fully.

Home
Search
New thread

Discussion

Discussion categories

General
Chat
Tech
Life
Art
Programming
open.mp
Development Updates
Questions and Suggestions
SA-MP
General Discussions
Videos and Screenshots
Support
Pawn Scripting
Tutorials
Releases
Plugins
Libraries
Filterscripts
Gamemodes
Maps
Advertisements
Other languages
Spanish/Espa?ol
Programaci?n
Discusi?n GTA SA Multijugador
Mods
Offtopic
Juegos
Portuguese/Portugu?s
Russian/русский
Italian/Italiano
Dutch/Nederlands
German/Deutsch
Romanian/Rom?na
Ex-Yu
Polish/Polski
Og?lne
Serwery
Skryptowanie
Filmiki i zdjecia
Lithuanian/Lietuvi?kas
French/Fran?ais
Hungarian/Magyar
Hindi/Urdu
Turkish
Other
Internal
Hidden

Library

Library pages

Collections
Links
Members
Roles
RegisterLogin
Login
Discussion
Programaci?n
[AYUDA] $(ELEMENTO).on('click')
qwerty's avatar

qwerty

@qwerty


View profile
Copy link
  Report member
• 7y
Programaci?n

[AYUDA] $(ELEMENTO).on('click')

Buenos d?as. Vengo a hacer una consulta sobre algo con jQuery y JS

La cosa es que, estoy intentando usar el comando ".on" para que, al hacer click en un bot?n, ejecute una funci?n. El problema es que, cuando este elemento est? presente varias veces en el documento, el mismo no funciona.

El comando ser?a:



$("#enviarCom").on("click",function(){
? ? ? ? ? ? var pub_id = $(this).attr('pid');
? ? ? ? ? ? muro.comentar(pub_id);
? ? ? ? ? ? return false;
? ? });



El problema es que, si el elemento (en este caso, <input id="enviarCom" pid="postid_diferente_por_cada_bot?n">) est? varias veces en el documento, el bot?n deja de funcionar. ?Se puede solucionar esto?

0 likes0 replies

    Please sign up or log in to reply