Disable lookup value
links from Display and AllItems page using Jquery
Step 1: Add HTML
Webpart on Lists Display or AllItems form
page.
Step 2: Add
Following code into Source Editor of HTML Form Webpart.
<script type="text/javascript"
src="../../Shared%20Documents/jquery-1.7.2.js"></script>
<script type="text/javascript"
src="../../Shared%20Documents/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(function () {
RemoveLookupLinks();
});
function RemoveLookupLinks() {
$('a[href*="RootFolder=*"]').each(function (index) {
var link = $(this);
$(this).after("<span>"
+ link.text() + "</span>");
$(this).remove();
});
//below code used if you selected
multiple lookup values in the column.
var vCity = $('h3:contains("City")').closest('td').next('td').find('a').text();
if (vCity!= undefined || vCity!= "") {
$('h3:contains("City")').closest('td').next('td').find('a').after("<span>"
+ vCity + "</span>");
$('h3:contains("City")').closest('td').next('td').find('a').remove();
}
}
</script>
Step 3: Save the Webpart and open Display form of list. The Lookup
links disabled from display form.
No comments:
Post a Comment