Questions tagged [insertafter]

The jQuery .insertAfter() insert every element in the set of matched elements after the target.

The jquery .insertAfter() insert every element in the set of matched elements after the target.

Consider the following HTML:

<div class="container">
  <h2>Greetings</h2>
  <div class="inner">Hello</div>
  <div class="inner">Goodbye</div>
</div>

We can create content and insert it after several elements at once:

$( "<p>Test</p>" ).insertAfter( ".inner" );

Each inner <div> element gets this new content:

<div class="container">
  <h2>Greetings</h2>
  <div class="inner">Hello</div>
  <p>Test</p>
  <div class="inner">Goodbye</div>
  <p>Test</p>
</div>
150 questions
210
votes
4 answers

How can I add an element after another element?

I have a certain textbox and I want to add a div after it. I've tried the .append() function, but that only adds the div in the element. For example, I have: and I want to change that into:
Jelle De Loecker
  • 20,999
  • 27
  • 100
  • 142
57
votes
11 answers

jQuery: What's the difference between after() and insertAfter()

jQuery has an .after() method, and also an .insertAfter() method. What's the difference between them? I think I can use .after() to insert elements after a selected element (or elements). Is that right? What's .insertAfter() for?
Cheeso
  • 189,189
  • 101
  • 473
  • 713
17
votes
2 answers

PHP DOMNode insertAfter?

I am a bit stuck on how to reorder nodes. I am trying to add two simple "move item up" and "move item down" functions. While insertBefore() does what I want to move a sibling before the preceding one, what is the easiest way to move one node down in…
Erik Pöhler
  • 742
  • 2
  • 9
  • 22
8
votes
6 answers

Add sliding animation to jquery insertafter and insertbefore

How to add animation moving effect to up and down sort movement. You can check the movement by clicking on the UP and DOWN text links. Here is my code $(document).ready(function(){ $('.move-up').click(function(){ if ($(this).prev()) …
Sowmya
  • 26,684
  • 21
  • 96
  • 136
7
votes
4 answers

insertAfter within a loop

I have some code generated by a CMS:
Link

Header here

Some text here
and I need to move the link to after the text div. I have tried…
AndyiBM
  • 379
  • 5
  • 17
6
votes
2 answers

jQuery .clone .insertAfter with a new ID

How can I clone a DIV, append it right after the div and give it a new identifier? I have a DIV with a class reflection, I want each instance of this DIV, cloned, and inserted right after the original, but with the class reflected (without the…
henryaaron
  • 6,042
  • 20
  • 61
  • 80
5
votes
1 answer

Move TinyMCE with jQuery

I have 2 (or more)
  • TheFox
    • 502
    • 10
    • 26
    5
    votes
    2 answers
    5
    votes
    2 answers

    JQuery Syntax error, unrecognized expression: ,

    I'm trying to simply add a comma after each element in a list. $('#tag_cloud-2 div.tagcloud a').each(function(){ console.log($(this)); $(", ").after($(this)); }); The console spits out the tags so I know it is finding them. I've tried…
    panzhuli
    • 2,890
    • 6
    • 33
    • 46
    4
    votes
    2 answers

    How to use InsertAfter with PowerShell

    I have some xml files where I want to insert the contents of one xml file into another. I thought I'd use LastChild and the InsertAfter method to accomplish this. So far it's not working for me. Here is the parent.xml file:
    Keith
    • 1,959
    • 10
    • 35
    • 46
    4
    votes
    1 answer

    Updating of NEW row is not allowed in after trigger

    Why do I get an error using this trigger? CREATE TRIGGER save_Assignee AFTER INSERT ON changeitem FOR EACH ROW BEGIN SET new.assignee = ( SELECT assignee FROM jiraissue INNER JOIN changegroup ON jiraissue.ID =…
    m.safivand
    • 79
    • 1
    • 1
    • 6
    4
    votes
    2 answers

    insertAfter specific element based on ID

    I have two lists of links. I have it such that when a user clicks on a link on either list, it is moved to the other list. Very quickly the lists become unorganised so I would like to keep them organised by an ID. What I want then is when a user…
    Chris
    • 26,744
    • 48
    • 193
    • 345
    3
    votes
    2 answers

    In jquery, how to show ajax progress image without shift controls to the right over

    i have a web page where there are 2 dropdowns next to each other. when you change one dropdown i go to the server and update the value in the second dropdown. Since this takes a few seconds, i have this code below that shows a ajax loading image…
    leora
    • 188,729
    • 360
    • 878
    • 1,366
    3
    votes
    1 answer

    jQuery insert html after comment tag

    How do insert html after in head document. For example I want to append css in head section with jquery after specific comment tag. $('', { rel: 'stylesheet', href: url }).appendTo($("