I am learning how to use jquery with SharePoint. My example draws a red border inside the web part of the content editor when the link is selected. My code works when the SharePoint page is in edit mode, but not after I left the page and returned without editing. The jquery function for some reason does not work ... I'm missing something simple, but not sure what.
Thanks for any help.
Kevin
My main page of the site is connected to the jquery-1.3.2.min.js file as follows:
<SharePoint:ScriptLink language="javascript" name="jquery-1.3.2.min.js"
Defer="true" runat="server"/>
The code for the content editor web part is as follows:
<style type="text/css">
#box
{
background: red;
width: 300px;
height: 300px;
display: none;
}
</style>
<script type ="text/javascript">
$(function() {
$('a').click(function() {
$('#box').slideDown(2000);
});
})
</script>
<div id="box">
<h1>This is text in the box</h1>
</div>
<a href="#">Display Box</a><br />
Kevin
source
share