jQuery 文本框不显示

标签 jquery html css

我试图在有人点击“点击我”按钮时显示一个文本框 Check here

当用户点击“点击我”按钮时我想显示区域彩色框。

这是我的代码。

HTML

<h1>Welcome to QuickSchools</h1>


<div id="section" style="display:none;">Here is a new section</div>
<div>Lorem Ipsum is simply dummy text of the printing and typesetting</div>
<button type="button" id="btn">Click Me</button>

CSS

#section{
background-color:red;
margin-left: 363px;
width: 200px;
height: 150px;
margin-top: -61px}

jQuery

$( "button" ).click(function() {
$("#section").show();});

有人能帮忙吗?

这是 jsFiddle:http://jsfiddle.net/nz7z9dtu/

最佳答案

请参阅 jsfiddle - http://jsfiddle.net/nz7z9dtu/9/

为了实现您正在寻找的东西 - prntscr.com/6tpi12 - 您应该在点击时减小“内容”类 div 的宽度并显示“部分”类。为此,您的 jquery 应该如下所示:

$( "button" ).click(function() {
    $(".section").show();
    $(".content").css("width", "70%")
});

关于jQuery 文本框不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29633822/

相关文章:

javascript - 我的谷歌地图路径符号不居中

html - 如何将此 bootstrap 4 表单垂直移动到屏幕中心?

php - 使用 PHP Ajax 输出到第二个 div

jquery - 循环遍历每个 HTML 表格列并使用 jQuery 获取数据

javascript - 如何用 jQuery 覆盖 CSS3 动画?

html - 在进度条背景上居中进度值

php - jquery限制输入范围

html - 中心 div 和 float 图像

css - 全宽 Material-UI Grid 无法正常工作

javascript - 正则表达式匹配来自包含多个类的单个字符串的 css 类名