How jq uses custom attributes to modify the class of this element

I have the custom attribute "data-oddsId"" in my html

Some values of

"data-oddsId" are the same, such as data-oddsId=1 (3-4 are the same)

The

requirement is that you want to use jq to search for this data-oddsId=1 element and add class

to this element.

add class to all when clicking, remove all class when clicking

    changeClass: function (pId, id, event) {
            console.log(pId);
            console.log(id);
      
            var _self = $(event.currentTarget);
            if (_self.hasClass("act")) {
                _self.removeClass("act")
            } else {
                _self.addClass("act")
            }
        },
Mar.09,2021

take a look at css selector

$('div[data-oddsld="1"]').addClass('')


 $("[data-oddsId='1']").addClass() 

Click event. Delete if there is class, and add

if there is no class.

toggleClass


$('div[data-oddsld="1"]').click(function(){
    $(this).toggleClass('active')
})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5a3ee-44073.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5a3ee-44073.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?