Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<script class="jsbin" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
  <script>
window.expandCollapse = function (id) {   
  var $arrowSpan = $("#" + id + " span"),
      arrowCharCode = $arrowSpan.text().charCodeAt(0);
  
  // 8659 is the unicode value of the html entity
  if (arrowCharCode === 8659) {
    $arrowSpan.html("&#8657;");                           
  } else {            
    $arrowSpan.html("&#8659;");                           
  }
  
  // one liner:
  //$("#" + id + " span").html( ($("#" + id + " span").text().charCodeAt(0) === 8659) ? "&#8657;" : "&#8659;" );
};
  </script>
</head>
<body>
  <h3 id="headerid1"><span onclick="expandCollapse('headerid1')">&#8657;</span>Header title 1</h3>
  <h3 id="headerid2"><span onclick="expandCollapse('headerid2')">&#8659;</span>Header title 2</h3>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers