Skip to content

Commit

Permalink
minor edits inject tab post
Browse files Browse the repository at this point in the history
  • Loading branch information
smchargue committed Feb 5, 2024
1 parent 6406aea commit 2bdb57f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions _posts/2024-02-04-InjectTabAction.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Injecting a tab action in an HTML5TabStrip widget"
date: 2024-02-05
tags: HTML5TabStrip JavaScript
---

## Summary
Expand Down Expand Up @@ -67,16 +68,20 @@ Suppose we didn't just want to open Bing but pass it some value we had on this p
{% include codeheader.html %}
```js
function addActionTab(element) {
const bing = 'https://www.bing.com/search?q=';
let bing = 'https://www.bing.com/search?q=';
let tab = jQuery(`<li class="k-item hs-actiontab">
<div class="k-link">Open Bing Search</div>
</li>`);
element.find('ul.k-tabstrip-items').append(tab);
tab.on('click', (e) => {
let elem = e.currentTarget; // this will be the DOM Element
let clientName = HSGetProperty(elem, 'clientname');
let url = bing + encodeURIComponent(clientName);
window.open(url, "_blank");
bing += encodeURIComponent(clientName);

// or, if you prefer terse code.
// bing += encodeURIComponent(HSGetProperty(e.currentTarget, 'clientname'))

window.open(bing, "_blank");
return false;
})
}
Expand Down

0 comments on commit 2bdb57f

Please sign in to comment.