开发者

jquery to create a pop up using document .createElement

I want to create a pop up using jquery.(with text box and two buttons)

how to create a 开发者_如何学JAVAtextbox and button using document.createElement and read the value from that textbox by clicking on that button. which jquery library I should import


First of all, have you tried google? There are tons of options. I usually use Dialog, because it's awesome and easy to use.


You should check out the jQuery UI Dialog


<p><a href="http://www.google.com" title="google.com" id="popOpen">open Google in a popup window</a></p> 
<script type="text/javascript"> 
$('#popOpen').popupWindow({ 
height:300px, 
width:300px, 
top:0px, 
left:0px 
}); 
</script>

this is from http://swip.codylindley.com/popupWindowDemo.html

Andy


I dont think you need to use document.createElement if you use the jQuery UI library. You need to go to http://jqueryui.com/download and create your download making sure dialog is checked in widgets.

You can create a div element on your page that contains your text box and two buttons. set the style to display:none so its hidden to start with.

e.g. .... code for your text box and 2 buttons

In your script file,

  1. You can attach the dialog to this div using its id, something like $('#dialog').dialog() ... (look at options for dialog)

  2. You can attach something for the click event of the button to read the value of the textbox

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜