-1

I want to create two toggle button in html using css. I want it so that when i click on one , it stays pushed in and the other in normal possition. The same will happen for both and vice versa.

If there is no way of doing it just using HTML and css. Is there a way to do it using jQuery or javascript?

Consider two buttons.TEST and LIVE,

How to do the above same,can i get help.

Thanks

user2086641
  • 4,331
  • 13
  • 56
  • 96

2 Answers2

0

you can use the JQuery toggle functionality and play with css.

Or you can use an easier way using JQuery (checkbox) that looks exactly like a toogle button. If you do this option, on click of the checkbox, you can check to see if it is checked and change the text of it like this

if($('#chk1').is(':checked')){
  $('#chk1').text('test');
}else{
  $('#chk1').text('live');
}
MaVRoSCy
  • 17,747
  • 15
  • 82
  • 125
0

With a quick google, here is a past Stackoverflow question that is similar: How do you create a toggle button?

Community
  • 1
  • 1
Andrew
  • 1,850
  • 14
  • 18