jQWidgets Forums

jQuery UI Widgets Forums Lists ComboBox jqxcombox selected id

This topic contains 3 replies, has 2 voices, and was last updated by  Dimitar 11 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • jqxcombox selected id #23680

    badialsoft
    Member

    Dear Sir

    i have two jqxinput and four jqxcombobox elements on a html form.
    the following codes return correct id when inputbox is selected
    but return ‘undefined’ in case of jqxcombobox is in focus.

    codes:
    var $focused = $(‘:focus’);
    var fe=$focused.attr(‘id’);
    alert(fe);

    please help me what is the correct method of getting ‘id’

    Thanks

    jqxcombox selected id #23786

    Dimitar
    Participant

    Hello badialsoft,

    Please post a larger sample, which contains the call for the code you provided.

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

    jqxcombox selected id #24203

    badialsoft
    Member

    Dear sir
    I am using $focused.attr(‘id’); function to get he unique id of the focused control.
    This function work correct on all other control’s but return ‘undefined’ in combobox case.

    You are requested to please provide me the correct method for this problem.

    thanks and regards
    sonee badial

    document.onkeydown = function(e) {
    e = e || window.event; // because of Internet Explorer quirks…
    k = e.which || e.charCode || e.keyCode; // because of browser differences…
    // alert(document.activeElement.id);

    document.getElementById(“demo”).innerHTML=”Key ” + k ;

    var evntform=’bad’; // only execute navig for form id=’bad’
    if ((k == 40 || k==13 ) && !e.altKey && !e.ctrlKey && !e.shiftKey) {
    var $focused = $(‘:focus’);
    document.getElementById(“demo”).innerHTML=”Control Id : ” + $focused.attr(‘id’);
    }
    // return false; // we processed the event, stop now.
    }
    $(document).ready(function () {
    var theme=getDemoTheme();
    $(“#Name”).jqxInput({ theme: theme , height: 25, width: 200, });
    var countries = [
    “India”,
    “America”,
    ];
    $(“#Roll”).jqxInput({ theme: theme , height: 25, width: 200,source:countries });
    $(“#txt3”).jqxInput({ theme: theme , height: 25, width: 200});
    $(“#txt”).jqxInput({ theme: theme , height: 25, width: 200});
    $(“#but1”).jqxButton({ width: 60, height: 25, theme: theme });
    $(“#but2”).jqxButton({ width: 60, height: 25, theme: theme });
    $(“#but3”).jqxButton({ width: 60, height: 25, theme: theme });
    $(“#chkbox”).jqxCheckBox({ width: 120, height: 25 });
    $(“#radio”).jqxRadioButton({ width: 120, height: 25 });
    var source1 = [ “Dr”, “Cr”];
    $(“#cmbdrcr”).jqxComboBox({ source: source1, selectedIndex: 0,dropDownHeight: 50, width: 150, height: 30, theme: theme});
    onwindowresize();
    });

    Radio Button 1
    check box1
    jqxcombox selected id #24231

    Dimitar
    Participant

    Hello badialsoft,

    The reason is that the input inside the combobox is actually on focus and not the combobox div itself.

    However, you may do the following:

    $("#jqxWidget").jqxComboBox({ source: source, selectedIndex: 0, width: '250', height: '25px', theme: theme });
    $("#jqxWidget input").attr("id", "comboInput");
    $("#jqxWidget input").focus(function () {
    var $focused = $(':focus');
    var fe = $focused.attr("id");
    alert(fe);
    });

    Best Regards,
    Dimitar

    jQWidgets team
    http://www.jqwidgets.com/

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

You must be logged in to reply to this topic.