<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<div id="myDiv">
<a href="#" data-target=".myDiv1">myDiv1</a>
<a href="#" data-target=".myDiv2">myDiv2</a>
<div class="myDiv1">Текст</div>
<div class="myDiv2">Текст2</div>
<div class="myDiv3">Текст3</div>
</div>
<script>
$(function(){
$('#myDiv a[data-target]').click(function(){
$('#myDiv [class*="myDiv"]').hide().filter($(this).data('target')).show();
});
});
</script>