jquery - Select element matching ID after a certain element, or create it if it doesn't exist -


  & lt; div id = "foo" & gt; FOO & lt; / div & gt; & Lt; div id = "nextfoo" & gt; & lt; / div & gt;   

मैं कैसे एक $ ('# foo') से #nextfoo का चयन कर सकता हूं। प्रत्येक () ... फ़ंक्शन, और यदि यह मौजूद नहीं है इसे बनाएं?

  var nextFoo = $ ('# nextfoo'); If (! NextFoo.length) {nextFoo = $ ('& lt; div id = "nextfoo" / & gt;')। InsertAfter ('# foo'); }   

आप ऐसा कुछ मतलब है?

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -