Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.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
Javascript 交换选择下拉id_Javascript_Html_Drop Down Menu_Jqgrid - Fatal编程技术网

Javascript 交换选择下拉id

Javascript 交换选择下拉id,javascript,html,drop-down-menu,jqgrid,Javascript,Html,Drop Down Menu,Jqgrid,我正在jqgrid中使用选择下拉列表。当服务调用成功时,我需要交换选择下拉列表id。 我需要这样做:: document.getElementById(lastRowId+"_selectId") = document.getElementById(actualId+"_selectId") 但我收到一个错误警报,比如::赋值的左侧不是引用 任何人都可以为此提供解决方案。使用您的代码,您不能交换IDdocument.getElementById(lastRowId+“\u selectId”)

我正在jqgrid中使用选择下拉列表。当服务调用成功时,我需要交换选择下拉列表id。 我需要这样做::

document.getElementById(lastRowId+"_selectId") = document.getElementById(actualId+"_selectId")
但我收到一个错误警报,比如::赋值的左侧不是引用
任何人都可以为此提供解决方案。

使用您的代码,您不能交换ID
document.getElementById(lastRowId+“\u selectId”)
返回元素。您可以直接设置id,如
document.getElementById(lastRowId+“\u selectId”)。id='newid'

试试这个:-

var id = lastRowId+"_selectId";
var id2= actualId+"_selectId";
var elem1 = document.getElementById(id);
var elem2 = document.getElementById(id2);
elem1.id =id2;
elem2.id =id ;

这就是你要找的吗?