bootstrap , redirect text()

by shigetak

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/js/swiper.jquery.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/3.4.2/css/swiper.css">
<link rel="stylesheet" href="http://health.eek.jp/files/cache/css/dhp/main.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://health.dmkt-sp.jp/files/cache/css/dhp/main.css">
<pre>
https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js
</pre>

<div id='#mainColumn'>

  <div class="titStyle04">
    <h1 class="title">エラーが発生しました</h1>
    <div class="sub">ERROR</div>
    <div class="description">申し訳ございません。アクセスしようとしたページが見つからないか、もしくは処理中にエラーが発生した可能性がございます。</div>
  </div>

</div>

JavaScript

alert($('.title').text());
// これでもERROR文字を拾えるが。複数条件でマッチさせさせる
alert($('.sub').text());
alert('飛びますよ');

var url = "https://health.dmkt-sp.jp/"
// ERRORという文字とマッチしたら 飛ばす
// 念のため深くセレクトする   
if ($("div.titStyle04 > div.sub").text() == 'ERROR') {
  location.href = url + "about"; // 任意のページを指定。
}