显示带有文本字段的警报框 [英] show alert box with Text field in it

查看:87
本文介绍了显示带有文本字段的警报框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是jquery新手.每当页面加载时,我想显示其中带有TextBox字段的Alert Box.像这样:

I am new to jquery. I want to show a Alert Box with TextBox field in it, whenever the page loads. Something like this:

Enter Your Username: //Title
___________________  //TextBox field (value will be stored in var for later use)

                OK   //Button

我知道

var username = "username";  //already entered message
alert(username);   

如何实现上述警告框?我应该手动编码吗?
最好在jQuery中给出示例.我正在尝试为我的聊天应用程序执行此操作,其中需要用户名才能在聊天中显示.我进行了大量搜索,但找不到与asp.net和jquery相关的任何有用信息.

How to achieve the above Alert Box? should I manually code it?
Giving an example in jQuery is preferable. I am trying to do this for my chat application where username is required to show in the chat. I searched alot but couldn't find any useful related to asp.net and jquery.

推荐答案

只需使用良好的旧JavaScript:

Just use good old JavaScript:

var text = prompt("prompt", "textbox's intial text");

在线演示

这篇关于显示带有文本字段的警报框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆