Windows 10 reached EOS (end of support) on October 14, 2025. If you are on Windows 10, see this article.

Eheka Pytyvõha

Emboyke pytyvõha apovai. Ndorojeruremo’ãi ehenói térã eñe’ẽmondóvo pumbyrýpe ha emoherakuãvo marandu nemba’etéva. Emombe’u tembiapo imarãkuaáva ko “Marandu iñañáva” rupive.

Kuaave

What about attribute 'checked' of input? What i should do: "removeAttribute('checked')" or "checked = false"?

  • 5 Mbohovái
  • 2 oguereko ko apañuãi
  • 18 Hecha
  • Mbohovái ipaháva cor-el

SCRIPT function vibor(){ if (document.getElementById('autologin').checked = true){ document.getElementById('autologin').removeAttribute('checked'); document.getElementById('autologin1').style.backgroundPosition = 'left top'; } else { document.getElementById('autologin').createAttribute('checked'); document.getElementById('autologin1').style.backgroundPosition = 'left bottom'; } } /SCRIPT If i used "removeAttribute", in face input is checked. But if i used "checked = false", input's face not checked, but it checked in HTML code (if FireBug don't lies). Please, helped me somebody! I don't know what i should do.

P.s. Please, don't scold me for my English. I don't speak English very much and that have a cause - i'm 14 years old and lived in Russia, where nobody may helped me.

SCRIPT function vibor(){ if (document.getElementById('autologin').checked = true){ document.getElementById('autologin').removeAttribute('checked'); document.getElementById('autologin1').style.backgroundPosition = 'left top'; } else { document.getElementById('autologin').createAttribute('checked'); document.getElementById('autologin1').style.backgroundPosition = 'left bottom'; } } /SCRIPT If i used "removeAttribute", in face input is checked. But if i used "checked = false", input's face not checked, but it checked in HTML code (if FireBug don't lies). Please, helped me somebody! I don't know what i should do. P.s. Please, don't scold me for my English. I don't speak English very much and that have a cause - i'm 14 years old and lived in Russia, where nobody may helped me.

Ñemoĩporã poravopyre

It is not an attribute, but a Boolean JavaScript variable and you can't remove it.

Note that if (document.getElementById('autologin').checked = true){} will set that variable always to true.

You probably want this:

function vibor(){
 if (document.getElementById('autologin').checked == true){
   document.getElementById('autologin').checked = false;
   document.getElementById('autologin1').style.backgroundPosition = 'left top'; 
 } else {
   document.getElementById('autologin').checked = true;
   document.getElementById('autologin1').style.backgroundPosition = 'left bottom';
   }
} 
Emoñe’ẽ ko mbohavái ejeregua reheve 👍 1

Opaite Mbohovái (5)

Если есть кто-то русскоговорящий, то объясняю: при использовании removeAttribute удаляется сам атрибут checked, но галочка на виду остаётся. А при юзании checked = false галочка убирается только на виду, но остаётся в html'e. Юзать обе функции одновременно?

А, хотя сам уже разобрался, знаете ли. Просто checked как атрибут задаёт отметку по умолчанию4 если кто не знает - напишу на всякий случай. Тему можно фтопку.

Ñemoĩporã poravopyre

It is not an attribute, but a Boolean JavaScript variable and you can't remove it.

Note that if (document.getElementById('autologin').checked = true){} will set that variable always to true.

You probably want this:

function vibor(){
 if (document.getElementById('autologin').checked == true){
   document.getElementById('autologin').checked = false;
   document.getElementById('autologin1').style.backgroundPosition = 'left top'; 
 } else {
   document.getElementById('autologin').checked = true;
   document.getElementById('autologin1').style.backgroundPosition = 'left bottom';
   }
} 

cor-el, thank you! I used this code and don't have a problem. This is checkbox of autologin to forum "Лунная студия" (moon studio) and that looks very beautiful! Again thank you!

You're welcome.