How to change the color of Listitems in Jquery Mobile? -


i trying change background color of list items in jquery mobile on button click adding css class list items not working here fiddle of work kindly me fix issue.

fiddle

function changelistbackground(){     $("#samplelist li").addclass("selectedli"); } 

the code have on jsfiddle button? no css? ensure div button located in has id "samplelist".

you should remove current class when adding new class, presume new css wish use located in css file , targets class "selected li".

you should switch classes add or remove functionality, can use built in functions of jquery following.

    $("#samplelist li").css("background-color", "yellow");  

or multiple styles use

    $("#samplelist li").css({"background-color": "yellow", "font-size": "200%"}); 

you should read book or 2 how use jquery if wish use successfully.

sean


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -