Onlick event, getElementById method, changing a button's text and text color

Onlick event, getElementById method, changing a button's text and text color

vassilis-javed khan

9 лет назад

34,646 Просмотров

In this video we demonstrate the onclick method and how to dynamically change the button's attributes with JavaScript.

Тэги:

#webforms #events #onclick #JavaScript
Ссылки и html тэги не поддерживаются


Комментарии:

FEE
FEE - 16.01.2020 11:08

hi, I did exactly like yours for doOnClick, but I can't make it work.

Ответить
Jammaz Marketing & Solutions
Jammaz Marketing & Solutions - 27.09.2019 11:07

i cant make the function executed when i put it in elementor html element/box

Ответить
Manoj Kumar Surisetti
Manoj Kumar Surisetti - 29.07.2019 15:48

How to change the color for example 1st click blue 2nd green 3rd red like that

Ответить
Umtul Basit
Umtul Basit - 15.10.2018 16:55

how to again change it from "ok tested" to "test"

Ответить
LUBNA HAQUE
LUBNA HAQUE - 17.07.2018 23:08

I am using multiple test buttons of same id. so when i click any of them only the first one is changing.kindly give me a solution.

Ответить
uppala adarsh
uppala adarsh - 05.05.2018 20:03

Increase the font size

Ответить
𝚋𝚊𝚡𝚝𝚎𝚛
𝚋𝚊𝚡𝚝𝚎𝚛 - 24.04.2018 18:39

how to change the button color

Ответить
Noah Gubish
Noah Gubish - 22.03.2017 23:24

how can i make where i press the text box and it changes the border color

Ответить
Become Informed Maine
Become Informed Maine - 29.05.2016 19:31

Finally an answer that was somewhat clear for "We Beginners"!

I was able to adapt this information to a function that toggles the color as I open and close a sub page.

<head>
<script type="text/javascript">
function Coalition(openB,closeB)
{
var c = document.getElementById(openB);
var d = document.getElementById(closeB);
if(c.value == 'Open Coalition Pages'){c.value = 'Close Coalition Pages'; c.style.color = 'red'; d.style.display = 'block';}
else{c.value = 'Open Coalition Pages'; c.style.color = 'black'; d.style.display = 'none';}
}

</script>
</head>

Ответить
NAVO17
NAVO17 - 04.05.2016 21:31

Was useful.
Thanks very much!

Ответить