如果名单是动态编制的,我如何在一份可选择的清单中拿到一个项目的id?
<ul id="selectable">
<li id= 1 >..</li>
.
.
<li...
</ul>
I Trial var num =$ ( #selecable :s selected ).attr (“option” , id );
, but have only [object Object].
正确的方式是什么?
如果名单是动态编制的,我如何在一份可选择的清单中拿到一个项目的id?
<ul id="selectable">
<li id= 1 >..</li>
.
.
<li...
</ul>
I Trial var num =$ ( #selecable :s selected ).attr (“option” , id );
, but have only [object Object].
正确的方式是什么?
<>Update:
就完整性而言,如果选定一个要素,则该图文在要素上添加一个类别<代码>,即由特定部分选定<>。 因此,可以通过下列途径获得目前选定的要素的识别资料:
$( #selectable .ui-selected ).attr( id );
但是,人们知道,可以选择<>多种内容>。
The jQuery UI selectedable plugin ,在你选择一个要素时,你只得提供:
$("#selectable" ).selectable({
selected: function(event, ui) { ... }
});
尽管如此,正如尼克已经提到的那样,国际发展研究中心不能从一位数开始。
<http://api.jquery.com/s selected-selector/“rel=“noreferer”>>
这一版本不需要特定类别的名称。 使用<代码>$(由上选)。
$( "#selectable" ).selectable({
selected: function(event, ui) {
alert( $(ui.selected).attr( id ) );
}
});
选定的粗金表如下:
$( #selectable ).selectable(function(){
selected:function(){
var idlist = $(this).attr( id );
//do something with the list...of id s
}
});
jQuery( #selectable ).selectable(function(){
selected: function(event, ui)
{
jQuery(".ui-selected", this).each(function()
{
var objID=jQuery(this).attr("id");
});
}
});
jQuery( #selectable ).selectable( function() {
selected: function(event, ui)
{
alert(ui.selected.id);
}
});
检查。
$( ".ui-selected", this ).each(function() {
var index = $( "#selectable li" ).attr(id);
});
<script>
$(function () {
$("#selectable").selectable({
selected: function () {
var id = $(".ui-selected", this).attr("id");
//alert(id);
}
});
});
How can the "Hide Pointer While Typing" option be disabled by application? I m having an issue with the cursor hiding and not getting it back without pressing escape or losing window focus. The ...
HI! I am new to C# and plan to use it for my application GUI. I am trying to make my GUI similar to SPSS:http://www.spss.com/images/08/statistics_screens/ez_rfm-big.jpg Is this easy in C#? Is there ...
My shoes application has three items stacked on top of each other (with a stack, of course), in order: A banner An edit box Two buttons in a flow What I want to do is have the banner stay at it s ...
I m running gnome and have a program that spawns off a large number of separate processes each with its own gui window. I d like to be able to selectively grab open windows whose titles match a ...
Usually, when we have to link an interface element to a field of a class, we use the keyword IBOutlet to inform the pre-copiler: @interface MyController : NSObject { IBOutlet NSWindow *...
I need to implement a custom search in a grid and I would like to find some user interface guidelines that explain the standard way to implement it. I mean this kind of search that is initiated by ...
I m having some problems with a small ircbot i m writing. Basically I connect to the server using a tcpclient in a seperate class, which also runs on its own thread. I want to display the server text ...
Is there a convention for the shortcut keys for application exit? Some applications uses Alt+X some others use Ctrl+ X and Ctrl+Q. Applications like FF and IE doesnot assign a shortcut at all. So is ...