Skip to content Skip to sidebar Skip to footer

How To Add Color On Listview When I Click In Jquerymobile

hi i Tried add color on ListView When i Click i Have List View like :- Copy

Then handle the click event of the LI and simply toggle the class:

$(document).on("pagecreate", "#page1", function () {
    $("#mylist").on("click", "li", function(){        
        $(this).toggleClass("activeLI");
    });    
});

DEMO

NOTE: If you are using jQM 1.3 instead of the latest,

.activeLI {
    background-color: #CFF09E!important;
    background-image: none;
}

The background is applied directly to the LI and the background-image is used for gradients.

jQM 1.3 DEMO

Solution 2:

you should to add that

$("#mylist").find("li").removeClass("activeLI");

to remove all class and disable the last background

Post a Comment for "How To Add Color On Listview When I Click In Jquerymobile"