[英]Disable moving of html elements
please check out this page. 请查看此页面。
Check Out 查看
As you can see i tried to add a live preview. 如您所见,我尝试添加实时预览。 I used jQuery html() to add elements to webpage.
我使用jQuery html()向网页添加元素。 But when anyone click on generate button the elements moves a little upward to add a new elements 'live preview'.Is there any way to remove this moving?
但是当任何人点击生成按钮时,元素会稍微向上移动以添加一个新元素``实时预览'',是否有任何方法可以消除这种移动?
Sorry for bad English(; 对不起,英语不好(;
<input id="url" type="text" value="http://"/><br/>
<button id="btn">Generate</button><br/>
<div id="opt">
&nbps;
</div>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js" type="text/javascript" ></script>
<script type="text/javascript">
$("#btn").click(function ()
{
$("#opt").html ("Live Preview");
});
</script>
something like this. 这样的事情。 Also why the Live Preview text having large padding from above element.
也是为什么实时预览文本从元素上方具有较大的填充。
Remove the none breaking space
删除无间断空格
from <div class="error"> </div>
来自
<div class="error"> </div>
Or you can just move the errors div below. 或者,您可以仅将错误div移到下面。 Like this:
像这样:
<div class="center">
<br>
<input id="url" type="text" value="http://"><br>
<button id="btn">Generate</button><br>
<input type="text" id="opt" placeholder="Generated Code will be here!">
<div class="error"> </div>
</div>
You have used
您已使用
for padding in <div class="error">
用于
<div class="error">
填充
It is removed by the jquery command $(".error").text("");
它由jquery命令
$(".error").text("");
删除$(".error").text("");
when the button is pressed. 当按下按钮时。 Either remove the
要么删除
in the original code (space will never exist), or change the jquery command to add it after the button is pressed (space will always exist). 原始代码中(空格将永远不存在),或更改jquery命令以在按钮按下后将其添加(空格将始终存在)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.