About js not changing the source code on the console I can’t help you, but about changing the color with jquery just assign a class equal to all elements you want to change color and do this:
//class do botão que muda de cor
$('.btn-muda-cor').click( function(){
//aqui eu pego o id, cada id vc pode colocar algo para identificar a cor
//que você deseja atribuir, ex: o id que eu peguei é igual a 1,então eu
//faço um if na hora de atribuir a cor que se id = 1 cor seja vermelha
//por exemplo.
var id_campo = this.id;
//chamo a função para atribuir a cor passando o id do campo
atribuir_cor(id_campo);
});
function atribuir_cor(id){
//comparo o id
if(id == 1){
//aí você coloca a class que quer que mude de cor
$('.class').css('background', red);
//o .css recebe 2 parâmeotros, o primeiro é o o nome da instrução do
//css e a segunda o valor que será atribuido a ele
}
}
On give F5 and restart, you can save the color or save the variable as of session in php, so you keep the color when changing page, der F5 etc. Or if your site has registered clients, you can save a db, then when you log in the site goes to the color that he set earlier
"i wanted a way that js did not change the source code on the console"... How so? Would prevent console changes?
– Sam
With "CSS Variable" you achieved this in a very easy way. But your question is too wide is hard to answer so, Create an example with code and edit your question that is easier
– hugocsl
@hugocsl Ample even, because if you give an F5 everything goes back to normal.
– Sam
If you look at twitter, in the theme change part, it will change the color of the whole site, but if you look at the source code on the console, you will see that nothing is changed, it seems magic, but I did not find how
– Robert Junio
@dvd e ai vai cookie / localStorage etc... difficult to give a simple answer... Roberto, start with clearer and objective questions, as your project goes going you will ask again that the site is for this same.
– hugocsl
Robert, but see that this is quite unnecessary whether you have the changes on the console or not. What matters is what the user sees on the screen
– Sam
I found out how ... it is very complex msm, but as soon as I finish, I will post the code
– Robert Junio
Associated: https://answall.com/questions/286813/como-memoriza-uma-a%C3%A7%C3%A3o-em-um-site
– Lauro Moraes