我被困在首先我需要在網格上找到文本是否「加入」或「加入」 然後如果它是加入錨標籤HREF將"/User/[email protected]&[email protected]"
.each循環來改變網格內錨標籤的href
,當它被「加入」的錨標記HREF將使用jQuery
這是我的審判,但其所有的,不是因爲工作之前,我想「加入」禁用是"/User/[email protected]"
`
$(document).ready(function() {
if ($('#btnEdit').text("Joined")) {
$('#btnEdit').prop('disabled', "disabled");
}
else {
$('#btnEdit').prop('disabled', true);
}
});
`
<td> <a href="/User/[email protected]&[email protected]" id="btnEdit" class="k-button" style="text-decoration: none;"> @item.IsJoined</a> </td>
我試用
$(document).ready(function() {
var txt = $('#btnEdit').text()
if (txt === "Joined") {
$('#btnEdit').prop('href', "/User/[email protected]");
}
else {
$('#btnEdit').prop('href', "/User/[email protected]&[email protected]");
}
});
先生,我該如何改變它來改變錨定標記Href? –
@RenTao檢查更新的答案。 –
el先生是什麼? –