1

i tried to use this

$("#aa").insertAfter($("<input type='text' name='category' value='h2' /\>"));

it seems didn't work for me

1 Answer 1

3

You want to use .after() here, like this:

$("#aa").after("<input type='text' name='category' value='h2' /\>");

.insertAfter() is the opposite, it takes the first element and tries to place it after the second element (or selector, whichever you give it), so it would look like this:

$("<input type='text' name='category' value='h2' /\>").insertAfter("#aa");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.