multiple event with javascript
/* get the button id "tg" which is used for toggling.Then on click few
elements with classname "adv" will disappear and at the same time few elements
with classname "btnpro" will increase in width to 80px*. Upon second click
elements with "adv" will appear again and the button width changes to 60px*/
document.getElementById("tg").onclick = function ()
{
my_fun1();
my_fun2();
}
function my_fun1()
{
var x = document.getElementsByClassName("adv")
for(var i=0; i<x.length;i++) {
if (x[i].style.display === "none") {
x[i].style.display = "block"
flag = false
} else {
x[i].style.display = "none"
flag = true
}
}
}
function my_fun2()
{
var x = document.getElementsByClassName("btnpro")
for(var i=0; i<x.length;i++) {
if(flag){
x[i].style.width = "80px";
}else{
x[i].style.width = "60px";
}
}
}
Also in JavaScript:
- javascript array of objects
- set cookie using nest js
- javascript cancel scroll
- measure width in px chrome extension
- chartjs lineTension
- local storage javascript array
- how to create a constant in javascript
- hot to start cypress
- jquery get value by name
- how to add multiple style attributes in react element
- add edit delete from table using jquery
- remove extra space in string javascript
- if isset handlebars js
- sorting number with coma datatable
- what is .eslint.js in vue
- javascript version of sleep
- javascript array remove middle
- changing map style react-leaflet
- open pdf in new tab javascript
- vue test utils mapgetter
- curl node exporter
- replace multiple spaces with single space javascript
- how to send post request js fetch
- vuejs 3 app.mount