jQuery toggleClass example

Toggle class name on click in jQuery

by aarkuo17

HTML

<!DOCTYPE html>
<html>
<head>
  <title></title>
</head>
<body>
  <table>
    <tbody>
      <tr>
        <td>
          <span id="MainContent_sPa10_Siuma2_U"><span id="MainContent_sPa10_Siuma2Name" style=
          "color:DarkRed;font-weight:bold;">法人代碼維護</span><br></span>
          <div>
            <table border="1" cellpadding="2" cellspacing="0" id="MainContent_sPa10_Siuma2" rules="all" style=
            "border-collapse:collapse;">
              <tbody>
                <tr>
                  <th scope="col">&nbsp;</th>
                  <th scope="col" style="color:Crimson;white-space:nowrap;">
                    <a href=
                    "javascript:__doPostBack('ctl00$MainContent$sPa10_Siuma2','Sort$%E6%B3%95%E4%BA%BA%E4%BB%A3%E7%A2%BC')"
                    style="color:Crimson;">法人代碼</a>
                  </th>
                  <th scope="col" style="color:Crimson;white-space:nowrap;">
                    <a href=
                    "javascript:__doPostBack('ctl00$MainContent$sPa10_Siuma2','Sort$%E6%B3%95%E4%BA%BA%E7%B0%A1%E7%A8%B1')"
                    style="color:Crimson;">法人簡稱</a>
                  </th>
                  <th scope="col" style="color:Crimson;white-space:nowrap;">
                    <a href=
                    "javascript:__doPostBack('ctl00$MainContent$sPa10_Siuma2','Sort$%E7%B5%B1%E4%B8%80%E7%B7%A8%E8%99%9F')"
                    style="color:Crimson;">統一編號</a>
                  </th>
                </tr>
                <tr>
                  <td><input id="MainContent_sPa10_Siuma2_修改_0" name="ctl00$MainContent$sPa10_Siuma2$ctl02$修改" onclick=
                  "mcf='';" type="submit" value="修改"> <input id="MainContent_sPa10_Siuma2_刪除_0" name=
                  "ctl00$MainContent$sPa10_Siuma2$ctl02$刪除" onclick="return confirm('資料將會刪除,請確認!!');" type="submit"
                  value="刪除"></td>
                  <td align="center" style="white-space:nowrap;"><span class="ovh" id="MainContent_sPa10_Siuma2_F0_0"
               ...

JavaScript

var a = '12345';