Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

help my button problem

Featured Replies

Please advise me
i am starter
i want to creat button with alternate color

i want button with default color

when i click the button change the color and process my work

and then re-click the button return to default color

how i can do it by whatever css or javascript?

 

 

 

you can use the JS onClick event for the button however with the two separate changes may be a little it more advanced than a starter.

This may be of use to you http://www.w3schools.com/jsref/event_onclick.asp

 

There are also ways to do this using the jQuery library but again may be a little bit more advanced

@@koolingblade Hiii,

 

 

I think if you want to Click on color therfore you should use Java Script.

 

if you want to cursor hover color than you should use hover attribute in css,

 

Find Bellow Code...

 

Html code

:

<button id="ButtonId">Hello</button>

 

CSS code

.ButtonClicked {

background-color:Red;

}

 

Java Script

 

$('#ButtonId').on('click',function(){

$(this).toggleClass('ButtonClicked');

});

Edited by Marlenmorlock

I wouldn't use JavaScript to toggle a class. Try something like this

 

HTML:

<button class="mybutton">Button text</button>

 

CSS:

.mybutton:active {

background-colour: #ff0000;

}

 

:active is the pseudo state on an element when it is being clicked.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.