如何从选定的多功能方框中获取选定数值?
The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...
如何从选定的多功能方框中获取选定数值?
与任何经常性投入/选择/选择一样:
$("form.my-form .chosen-select").val()
$("#select-id").chosen().val()
这对我来说是有效的。
$(".chzn-select").chosen({
disable_search_threshold: 10
}).change(function(event){
if(event.target == this){
alert($(this).val());
}
});
$("#select-id").chosen().val()
这是正确的答案,我尝试过,其价值是通过“、”分离的价值观。
如果任何人只想把选定的价值点击到一种选择中,他就可以做到如下:
$( .chosen-select ).on( change , function(evt, params) {
var selectedValue = params.selected;
console.log(selectedValue);
});
到2016年,你可以做的只是已经作出的任何答复:
$( #myChosenBox ).val();
在“MChosenBox”是原始选定投入的背后。 或者,在变化活动中:
$( #myChosenBox ).on( change , function(e, params) {
alert(e.target.value); // OR
alert(this.value); // OR
alert(params.selected); // also in Panagiotis Kousaris answer
}
if you want to get text of a selected option (chosen get display selected value)
$("#select-id").chosen().find("option:selected" ).text();
这一解决办法对我有利。
var ar = [];
$( #id option:selected ).each(function(index,valor){
ar.push(valor.value);
});
console.log(ar);
be sure to have your <option>
tags with they correspondant value
attribute.
Hope it helps.
我认为,由于Chosen将从原来的<条码>(选择条码>)中复制该身份证,因此在以ID为对象时就会出现问题。 页: 1
在通过ID选定Chosen时,使用<代码>电子<>/代码>的选定器:
$( select#yourID ).on( change , function() {
console.log( $( this ).val() );
} );
......
$( #yourID ).on( change , function() {
console.log( $( this ).val() );
} );
之所以这样做,是因为Chosen将其选定的项目与原始(现为隐蔽的)<代码>(连多极的>选择要素相仿。
(It also continues to work with or without Chosen, say... if you decide to go a different direction in your application.)
The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...
How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.
I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.
I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...
Ok, I m stumped. Basically, this script works fine in FF, but not in IE (6,7 or 8) - in which it returns an "Object doesn t support this property or method" error. Any ideas?: function ...
What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...