Answer the question
In order to leave comments, you need to log in
Dynamic select id?
Hello!
There are many buttons, with id sync_site_1, sync_site_2 etc.
I need to add a class to the pressed button, now I did for one:
$(document).ready ->
$("#sync_site_1").on("ajax:success", (e, data, status, xhr) ->
$("#sync_site_1").toggleClass "site_is_sync"
)
Answer the question
In order to leave comments, you need to log in
$('button[id^="sync_site_"]')
- will return all buttons whose id starts withsync_site_
And classes to use for the selector or other attributes besides id
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question