Adding javascript: onclick event in SharePoint Page Content

Reading Time: 1 minute

SharePoint site Publishing Site PageContent facing issue and Solution

In page content, any JavaScript added will not be retrained. However we can achieve this using jQuery.

 

Solution 1)      Add a CSS class to the Hyperlink for ex : ‘<a href=”#” class=’acclink’>click here</a> ’2)      Add Content Editor Webpart, and add the below code 


<script type=”text/javascript”>                                $(document).ready(function(){                                 $(‘a.acclink’).click(function(){                                    alert(‘hi’); //add ur code                                });                                });                          

</script>


Tagged: SharePoint , Page Content , MOSS-2007

Comments are closed.