Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 从列表框移动到其他列表框_Jquery_Asp.net - Fatal编程技术网

Jquery 从列表框移动到其他列表框

Jquery 从列表框移动到其他列表框,jquery,asp.net,Jquery,Asp.net,我有以下代码: HTML <table width="30%" border="0"> <tr> <td colspan="4" align="center"> <asp:Label ID="Label12" runat="server" CssClass="label" Text="Responsabilidades"></asp:Label> </td> </tr> <tr>

我有以下代码:

HTML

<table width="30%" border="0">
<tr>
    <td colspan="4" align="center">
<asp:Label ID="Label12" runat="server" CssClass="label" Text="Responsabilidades"></asp:Label>
    </td>
</tr>
<tr>
    <td colspan="4">
        <asp:ListBox ID="lstDisponibles" runat="server" Width="140px" 
            Height="110px" SelectionMode="Multiple">
            <asp:ListItem>s</asp:ListItem>
            <asp:ListItem>w</asp:ListItem>
            <asp:ListItem>f</asp:ListItem>
        </asp:ListBox>
    </td>
    <td>
        <input id="imgAdd" type="image" src="../../images/control_fastforward.png" value="button" />                                   
        <br />
        <input id="imgRem" type="image" src="../../images/control_rewind.png" value="button" />                                   
    </td>
    <td>
       <asp:ListBox ID="lstUsuario" runat="server" Width="140px" Height="110px" SelectionMode="Multiple">
        </asp:ListBox>
    </td>
    <td></td>
</tr>

</table>
$(document).ready(function () {
    $("#imgAdd").click(function () {
        $("#lstDisponibles > option[@selected]").appendTo("#lstUsuario");
    });
    $("#imgRem").click(function () {
        $("#lstUsuario > option[@selected]").appendTo("#lstDisponibles");
    });
}); 
我想从有争议的文件转移到有争议的文件,但这不起作用。 我可以找到任何使用asp.net listbox元素的示例。我使用html标记进行测试,但这不会有用

任何人都可以帮我做这个


谢谢。

尝试从以下位置更改选择器:

#lstDisponibles > option[@selected]
致:

新增内容将是:

$("#lstUsuario").append($("#lstDisponibles > option:selected"));
它们应该是

$("#lstDisponibles > option:selected")

还要注意.net不会更改您的ID。

不要工作,朋友,我正在使用母版页。我使用这个代码,但不使用work@haggar查看源代码并查看列表框的id属性,它是什么?使用。它会给你asp.net生成的id。不工作,我的朋友,我知道为什么$().ready(function(){$(“#imagenAgregar”)。单击(function(){$('option:selected')。appendTo(“”);return false;});$(“#imagenQuitar”)。单击(function(){$('option:selected')。appendTo(“”);return false;});});
$("#lstDisponibles > option:selected")