If I have these objects:
<div id='1'></div>
<div id='2'></div>
<div id='3'></div>
<div id='4'></div>
<div id='5'></div>
I have a textbox:
<input type="text">
Where I type in the value: 3.5 to dynamically make (I have the code for this, the next part I need help with):
<div id='3.5'></div>
How can I attach it in this order below, without first checking to see the value of every div on the page?
<div id='1'></div>
<div id='2'></div>
<div id='3'></div>
<div id='3.5'></div>
<div id='4'></div>
<div id='5'></div>
Using:
$('#What Goes Here If I Dont know the elements on the page?').after('<div id='3.5'>Hey</div>');
Any help is appreciated,
Taylor
IDs in the DOM should not start with a number (they would not be valid).
They should start with a character
A-Za-zand then they can have numbers,-and_following.but if you want to go your route try this:
Here is a fiddle demo: http://jsfiddle.net/maniator/DPMV5/