Q:

Find next element with a class is exist

In JQuery if we need to find a element exist we can use
 $(".pane").length

In my case i need to append a div like this
parent('.parent').next().append('<div class="classname">....</div>');

But before append i need to check already that div element exist next to my parent.
I wrote like this. but it is not checking
function show(xxx)
{
  if(!($(xxx).parent('.parent').next('.classname').length))
  {

  }
}

But not working. help to write the if check

A:

The problem seems to be that the classname is not the next sibling, it is the content of the next sibling
function show(xxx) {
    if (!($(xxx).parent('.parent').next().find('.classname').length)) {
        $(xxx).parent('.parent').next().append('<div class="classname">....</div>');
    }
}

Demo: Fiddle

Or do you want something like
function show(xxx) {
    var $p = $(xxx).parent('.parent');
    if (!$p.next().is('.classname')) {
        $p.after('<div class="classname">....</div>');
    }
}

Demo: Fiddle

