私はシンプルなJQueryソリューションを使用してリンクからhrefを取得し、それをクリックイベントに適用します。これはWebkitとGeckoのブラウザでは機能しますが、Internet Explorer(& 8)はhrefの位置をと定義していませんと表示し続けます。誰でもこれを修正しましたか?これを解決するのに役立つことができますか?もしそうなら大いに感謝します。.attr( 'href')returns undefined
$('table tr').click(
function() {
var element = $(this).attr("class");
var hrefLocation = $('#'+ element +' .deal-holder a').attr('href');
alert(hrefLocation)
window.location.href = hrefLocation;
return false;
}
);
HTMLは単純です:
<tr class="QRG">
<td class="blue"><a href="#QRG">QRG</a></td>
<td>Company Sale</td>
<td>Technology</td>
</tr>
<div class="deal" id="QRG">
<p><span class="js">Overview</span><span class="no-js">Enham</span></p>
<div class="deal-holder">
<div class="image-holder">
<img src="../assets/images/enham.gif" alt="" height="70" width="150" />
</div>
<p>Enham is a charity established in 1918, which delivers a wide range of essential services that provide choice and empowerment to disabled people to make their own decisions about their lives. Enham is a charity established in 1918, which delivers a wide range of essential services that provide choice and empowerment to disabled people to make their own decisions about their lives</p>
<a class="moreInfo" href="individual.html">More Information</a>
</div>
</div>
? [テストケースを作ってください](http://jsfiddle.net)。 –
こんにちは@jhuiあなたのテーブルtrのHTMLの例を投稿することができますか? ta。 –
テーブル行のクラスが別のelemntのIDでない限り、実際に何も選択していません。 を含むテーブルのhtmlを投稿できますか? – yoozer8