jQWidgets Forums
jQuery UI Widgets › Forums › Lists › ComboBox › jqxcombox selected id
Tagged: combobox, focus, id, Input, jqxComboBox
This topic contains 3 replies, has 2 voices, and was last updated by Dimitar 11 years, 8 months ago.
-
Authorjqxcombox selected id Posts
-
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
Hello badialsoft,
Please post a larger sample, which contains the call for the code you provided.
Best Regards,
DimitarjQWidgets team
http://www.jqwidgets.com/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 badialdocument.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 1check box1Hello 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,
DimitarjQWidgets team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.