CodePen

HTML

            
              <div class="container">
	<h1>Changing titles</h1>
	<div class="tabbertab" title="Original title">
		<div class="editorTitle">
			<h2>New title</h2>
			<p>Grab the text from the hidden H2 below and make this div's title equal to it.</p>
			<h2 class="grabThis">Profile</h2>
		</div>
	</div>

	<div class="tabbertab">
		<div class="editorTitle">
			<h2>Another title</h2>
			<p>This is another fun paragraph of text</p>
			<h2 class="grabThis">Research</h2>
		</div>
	</div>
</div>
            
          
!

CSS

            
              body {
			font-family: helvetica, arial, sans-serif;
			font-size: 12px;
			background-color: #eee;
			color:#383838;
}

.container {
  width:40%;
  margin:0 auto;
}

.grabThis {
  display:none;
}
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              $('.tabbertab').each(function(){
			var h = $(this).find(".grabThis").text();
			$(this).attr('title', h);
});
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................