Changing the background color of a
section

后端 未结 3 794
无人及你
无人及你 2021-01-24 16:41

I\'m trying to use jQuery to change the background color of a

section when pressing on a button, and below is the code to do that. Why isn\
3条回答
  •  南笙
    南笙 (楼主)
    2021-01-24 17:19

    Ensure you include the CSS selector inside the jQuery that you wish to target.

    $("bgcolor").click(function(){
    

    Should be:

    $("#bgcolor").click(function(){
    

    Because you are targeting an ID.

提交回复
热议问题