当前位置:Gxlcms > JavaScript > 得到jQuery detach()后节点中的某个值实现代码

得到jQuery detach()后节点中的某个值实现代码

时间:2021-07-01 10:21:17 帮助过:4人阅读

需要jQuery -detach 后的dom 结构或某个值 。
代码如下:

<body>
<input type="text" value="test" name="showtime" id="showtime" />
<input type="button" onclick='showDetach();'/>
</body>
<script type="text/javascript">
var obj = '';
setTimeout(function(){
obj=jQuery("#showtime").detach() ; // 需要用jquery转换一下。
},1000) ;

function showDetach(){
alert(jQuery(obj).val()) ;
}
</script>
</body>

人气教程排行