Edit this page

badge

Introduced in Q1 2013 SP Sets a badge on the Button with the specified value. If invoked without parameters, returns the current badge value. Set the value to false to remove the badge.

Parameters

value String |Boolean

The target value to be set or false to be removed.

Returns

String | kendo.mobile.ui.Button the badge value if invoked without parameters, otherwise the Button object.

Example

<div id="foo" data-role="view">
  <a data-role="button" data-badge="1" data-click="countClicks">Foo</a>
</div>

<script>
var app = new kendo.mobile.Application();

function countClicks() {
    var badge = parseInt(this.badge()); //get badge value
    badge++;
    this.badge(badge); //set new badge value
}
</script>

Example - remove the badge

<div data-role="view">
  <a id="btn" data-role="button" data-badge="1">Foo</a>
  <a data-role="button" data-click="removeBadge">Remove badge</a>
</div>

<script>
var app = new kendo.mobile.Application();

function removeBadge() {
  $("#btn").data("kendoMobileButton").badge(false);
}
</script>
Is this article helpful? Yes / No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article

close
Dummy