Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use switch switch event handling for Bootstrap

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you how Bootstrap uses switch switch event handling, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

You need to use Bootstrap switch to implement the pass and reject functions and display the textarea box to enter the reason when you switch to reject. 1. Css reference 2, js reference 3, page (open with modal If you need to use, you need to reference the corresponding js and css) × close the monthly report for approval

If not, Please state the reason: close Submit 4. Js page $("[name='my-checkbox']") .bootstrapSwitch ({onText: "reject" OffText: "pass", onColor: "danger", offColor: "success", size: "large", / / onSwitchChange method to monitor switch switch status onSwitchChange: function () {/ / .prop method to view the checked property of input Even if you check its switch status var checkedOfAll=$ ("# my-checkbox") .prop ("checked") / / false and true correspond to the checked attribute of input. Show and hide the input box if (checkedOfAll==false) {$('# approve_input'). Hide ()} else {$('# approve_input'). Show ()}) Click ('# submit') .click (function () {var checkedOfAll=$ ("# my-checkbox"). Prop ("checked"); var checkinfo=$ ('# approve_area'). Val (); alert (checkedOfAll+checkinfo)}) these are all the contents of the article "how Bootstrap uses switch switch event handling". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report