0

I need to add HTML Tags in a precise position using Javascript

<div id="myId">
   <div id="addAfter"><div>
   <***here I need to add a set off HTML Tags***>
   <div ><div>
   <div><div>
</div>

javascript code

  var ol = '<ol id ="div_blue"><li><img id="blueUp" src="<c:url    value="/resources/style/images/btup.png"/>" alt =""/></li><li>....</li>< /ol>' ;
  $("#myId").InsertInPosition2(ol);

but how to define InsertInPosition2?

thanks

imprim ecran

enter image description here

1 Answer 1

2

Use .after()

$("#addAfter").after(ol);

Demo: Fiddle

If you want to add the element with reference to the parent element then

$("#myId").children().first().after(ol);

Demo: Fiddle

Sign up to request clarification or add additional context in comments.

9 Comments

yes it's nice but I have a problem too with the attribute src = ".../btup.png" I noticed that this method create a new img called btup.png but I have already this image and I need just to use it and not to create a new one so I have this error GET localhost:8084/resources/style/images/btup.png 404 (Not Found)
@LallouDaddou what is the path to the existing image
the same path src="/resources/style/images/btup.png"
if the path is the same then how are you getting a 404
because he create a new one I'll add a capture screen
|

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.