[Solved] Change div id/class onclick


maybe I did not fully understand what you need, but try something like this

UPDATED

HTML code

 <div class="box">
  <div class="one">
    <p>this is my content number 1</p>
  </div>

  <div class="two">
    <p>this is my content, which should show up when clicking button1</p>
  </div>

  <button class="button1">im a button</button>
</div>

CSS code

.one,
.two {
  width: 150px;
  height: 150px;
  float: left;
  margin-left: 10px;
  margin-right: 10px;
  padding: 10px;
  background: pink;
}

.two {
  display: none;
  background: silver;
}

JQ code

$( '.button1' ).on( 'click', function () {
    $( '.one' ).remove();
    $( '.two' ).show();
});

watch demo on JSFiddle

4

solved Change div id/class onclick