What type of selector do I need to insert after the parent (divouter) class test3 in the example below? Thanks.
<div class='divouter'> <div class='divinner'> <input class=test1></input> </div> </div> <div class='divouter'> <div class='divinner'> <input class=test2></input> </div> </div> <div class='divouter'> <div class='divinner'> <input class=test3></input> </div> </div> <div class='divouter'> <div class='divinner'> <input class=test4></input> </div> </div>
You can use the $.after() method:
$.after()
$(".test3").closest(".divouter").after("<div>Foo</div>");
Or the $.insertAfter() method:
$.insertAfter()
$("<div>Foo</div>").insertAfter( $(".test3").closest(".divouter") );
.divouter:parent
I think you want the after () method:
$('input.test3').focus(function() { $(this).closest('div.divouter').after('<div>Hi!</div>'); });
Source: https://habr.com/ru/post/1301278/More articles:Trying to use std :: list in objective-c program - listauto repeat up / down arrow? - javascriptCSS Line Building Guide - cssA simple BBCode editor for WYSIWYG for JavaScript? - javascriptMonitoring and preventing system crashes for Mnesia on an Erlang system - erlangActivity indicator (counter) using UIActivityIndicatorView - objective-cIs it easy to switch from relational to non-relational databases using Rails? - ruby-on-railsDjango: What is the best practice of structuring global templatetags? - djangoHow to use Automator to bring a window to the fore? - macosCheck HTTP request source - pythonAll Articles