点击文本框弹出窗口 选择窗口里面文字


<script type="text/javascript">
$(function () {
$("#input").click(function () {
$("#open,#close").show();
});
$("#close").click(function () {
$("#open,#close").hide();
});
$(".list").click(function () {
$("#input").val($(this).html());
$("#open,#close").hide();
});
});
</script>

<style type="text/css">
#close{width:100%;height:100%;position:fixed;z-index:8888;margin:0;padding:0;display:none;}
#open{background-color:#efefef;width:200px;height:200px;z-index:9999;position:absolute;;display:none;}
.list{margin-left:15px;cursor:pointer;} 
</style>

html:

<input type="text" id="input"/>
<div id="open">
<span class="list">文字1</span>
<span class="list">文字2</span>
<span class="list">文字3</span>
</div>
//close为透明背景层,为了点击open以外地方open关闭。
<div id="close"></div>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM