English 中文(简体)
添加工具,以安装残疾人boot网
原标题:Add tooltip to disabled bootstrap button

I ve Trial Solutions found on other similar threads, but can ted them work. 我ve一个boot子,在残疾状态下,应当有一个工具让使用者知道它为什么会致残。 我理解,一个残疾州有一个县,它防止 mo化事件达到纽伦要素,而如果有人看我的守则,让我知道我做错做什么,我非常赞赏这样做。 解决任何间隔问题,我曾用自动制成的代码,但显示所有胜利,我尝试人工调整!

 // Grab button from DOM
 let resultsBtn = document.getElementById("get-results-btn");
 
 // if conditional is met, disable button
    $(resultsBtn).prop("disabled", true);
    
    // then, add tooltip 
       $(resultsBtn).attr("data-toggle", "tooltip");
       $(resultsBtn).attr("title", "you may only submit this form once");

       // add css rules to make tooltip work on disabled button
          $(resultsBtn).css("pointer-events", "none"); 
/* ====================================== */
/* Button styling */
/* ====================================== */

#get-results-btn {
  // insert styling rules for color, size, etc. here, plus the following rules:
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  pointer-events: none; ////// Added this based on [S/O thread][1]
}

#get-results-btn  .btn[disabled] //// I pulled this line from [S/O thread][1], but I don t think the class applies to my code?
<button id="get-results-btn" class="btn standard-btn-style">
  Get Results
</button>
问题回答

该法典:

 // Grab button from DOM
 let resultsBtn = "#wrapper";
 
 //// if conditional is met, disable button
 $("#get-results-btn").prop("disabled", true);
    
    // then, add tooltip 
       $(resultsBtn).attr("data-bs-toggle", "tooltip");
       $(resultsBtn).attr("title", "you may only submit this form once");
#get-results-btn {
  display: inline-block;
}

#get-results-btn .btn[disabled] {
    pointer-events: none;
    
}
<div id="wrapper">

<button id="get-results-btn" class="btn standard-btn-style">
  Get Results
</button>

</div>
 <!--CDNs-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/[email protected]/dist/umd/popper.min.js" integrity="sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-BBtl+eGJRgqQAUMxJ7pMwbEyER4l1g+O15P+16Ep7Q9Q+zqX6gSbd85u4mG4QzX+" crossorigin="anonymous"></script>

我对你的法典作了修改:

  • 在纽伦加上一个包裹,使包装人能够展示工具

  • 添加了<条码>点名-秒:无。 更正。

  • 在javascript代码中,应当使用data-bs-toggle而不是data-toggle





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签