1

Please refer to the fiddle at http://jsfiddle.net/D5ss8/458/

<ul class="bjqs-controls v-centered">
    <li >test</li>
    <li>test</li>
</ul>
<ol class="bjqs-markers h-centered">
    <li>test2</li>
    <li>test3</li>
</ol>
<input type="button" value="click me" />

JavaScript:

$('input').click(function() {
   $('ul.bjqs-controls v-centered').empty();
    $('ol.bjqs-markers h-centered').empty();
});

I want to remove "li" and "ol" from DOM using its class name. Here now, both contains two class names due to which empty function is now working. It works when single class name is given.

JJJ
  • 32,902
  • 20
  • 89
  • 102
Mahendra
  • 153
  • 2
  • 5
  • 15

3 Answers3

0

Just use two class qualifiers:

$('ul.bjqs-controls.v-centered').empty();

There should not be a space between them. You can do all this with just one call:

$('ul.bjqs-controls.v-centered, ul.bjqs-controls.h-centered').empty();
Pointy
  • 405,095
  • 59
  • 585
  • 614
0

You can stick two class together without space:

$('ul.bjqs-controls.v-centered').empty();
$('ol.bjqs-markers.h-centered').empty();

Updated Fiddle

Eli
  • 14,779
  • 5
  • 59
  • 77
0

http://jsfiddle.net/mohammadAdil/D5ss8/459/

$('input').click(function() {
   $('ul.bjqs-controls.v-centered').empty();
   $('ol.bjqs-markers.h-centered').empty();
});
Adil Shaikh
  • 44,509
  • 17
  • 89
  • 111