使用javascript重新对齐HTML [英] Realign HTML using javascript

查看:41
本文介绍了使用javascript重新对齐HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的HTML:

"""<input type="submit" id="continue" value="CRA" name="continue" class="keyboard-enabled" tabindex="7">

<a href="#" id="r1A" role="button" tabindex="-1">
    <input type="button" id="r1B" value="Back" role="option" aria-pressed="false" class="keyboard-enabled" tabindex="6">
</a>"""

我想使用jquery replace或JS中的类似内容将我的第一个输入向下移动到<a.如何实现呢?

I want to move my first input down to <a using jquery replace or something like this in JS. How to achieve this ?

预期输出:

<a href="#" id="r1A" role="button" tabindex="-1">
    <input type="button" id="r1B" value="Back" role="option" aria-pressed="false" class="keyboard-enabled" tabindex="6">
</a>
<input type="submit" id="continue" value="CRA" name="continue" class="keyboard-enabled" tabindex="7">

推荐答案

尝试一下:使用.after()

$(function(){
  $('#r1A').after($('#continue'));
});

这篇关于使用javascript重新对齐HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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