jQuery UI Widgets Forums Editors Button, RepeatButton, ToggleButton, LinkButton getSelection on buttongroup returns null

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 10 years, 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author

  • dbs222

    Hi. trying to use the getSelection method to id which button in the buttongroup is selected. Code looks like this:

    $(document).ready(function () {
    var theme = getDemoTheme();
    $(“#tpTempPrcpGrp”).jqxButtonGroup({ theme: ‘web’, mode: ‘radio’ });

    $(‘#tpTempPrcpGrp’).on(‘selected’, function () {
    var whichButton = $(‘#tpTempPrcpGrp’).jqxButtonGroup(‘getSelection’);

    alert returns NULL

    what am I doing wrong? Thanks!


    Peter Stoev


    According to me, the problem is the additional }); after the widget initialization.

    Below is a working sample:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <title id='Description'>The jqxButtonGroup widget creates a set of buttons that can work as normal buttons, radio buttons or checkboxes.</title>
    <script type="text/javascript" src="../../scripts/gettheme.js"></script>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.10.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttongroup.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxradiobutton.js"></script>
    <body class='default'>
    <div id='content'>
    <script type="text/javascript">
    $(document).ready(function () {
    $("#tpTempPrcpGrp").jqxButtonGroup({ theme: 'web', mode: 'radio' });
    $("#tpTempPrcpGrp").on('selected', function () {
    var whichButton = $("#tpTempPrcpGrp").jqxButtonGroup('getSelection');
    <div id='tpTempPrcpGrp'>
    <button style="padding:4px 16px;" id="Left">
    <button style="padding:4px 16px;" id="Center">
    <button style="padding:4px 16px;" id="Right">

    Best Regards,
    Peter Stoev

    jQWidgets Team

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.