How do I edit PHP variable with JavaScript/jQuery?

后端 未结 2 1313
野性不改
野性不改 2020-12-07 00:08

I want to update a PHP variable $LinkOpen based on the current state of a checkbox element .avflipswitch.

Based on the .avflipswitch<

2条回答
  •  Happy的楠姐
    2020-12-07 00:42

    What you are trying is not possible in php, but very easy with jquery:

    $('.avflipswitch').on("change", function (e){ 
        if(this.checked){
         $('a').attr("target","_self")
        }
        else{
         $('a').attr("target","_blank")
        }
    });
    

提交回复
热议问题