Hot answers tagged

15

Here is a post that shows how to do this. Link The following jQuery can be placed in a content editor webpart or on the masterpage, which is how I implemented it. function makeHeaderCollapsible() { $("div.menu-vertical>ul.root>li.static>ul.static").css("display", "none"); $("div.menu-vertical>ul.root>li.static>span.static").toggle ( ...


7

You can use the JSLink property to load multiple files. Include a url to the jQuery file and you have a nice workaround. Please note that you will have to use a url within the same web application, you can’t reference the library from a CDN or similar. Try something like this: $Field.JSLink="~sitecollection/Style ...


6

I'm sure there is room for improvement, but here is a working sample. jQuery(document).ready(function () { //narrow down matching to dialog boxes only if(location.href.indexOf('IsDlg=1') !== -1) { $(".ms-dialog td.ms-formbody > span > table > tbody > tr:first-child > td > span.ms-RadioText").each(function(){ ...


5

Ok, solved it. The script links to the jQuery and jQuery UI files needed to have the language and type attributes set. This did not work: <script src='/sites/mysite/SiteAssets/Scripts/jquery-1.11.1.min.js' ></script> <script src='/sites/mysite/SiteAssets/Scripts/jquery-ui.min.js' ></script> <script> $(function () { ...


5

You certainly can; Rich's approach will work (and is probably the way I'd do it), you also have the option of porting the quick launch into an accordion control (there's a few plugins out there, or you can utilize jQuery UI). The nice thing about Rich's method is that it doesn't require re-rendering the quick launch--it's simply hiding or showing the ...


5

If the page the JSLink is on is not referencing jQuery and jQuery UI scripts, you will need to load them yourself. This can be done by for example: function loadScript(url, callback) { // adding the script tag to the head as suggested before var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); ...


4

Thanks for Tiago for providing the solution. So here is the code if you want to move description up for Multiple lines of text. $("td.ms-formbody > span > textarea.ms-long").each(function(){ var descriptionElement = $(this).closest('.ms-formbody').contents().filter(function(){ return this.nodeType != 1; }); var descriptionText = ...


4

The whole essence of async REST calls is that they do not stall other code. SOD won't be of help because it has no clue you are waiting for other operations to finish Best thing is to handle those REST operations properly: http://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-requests-are-done If you have no control over that code your ...


3

Ensure that the html element that the datetime control is in has the css property: position:relative; That ensures that the absolute positioning of the element inside it will be relative to its container.


2

Rather than using the _spBodyOnLoadFunctionNames function, go with jQuery's $(document).ready(). Also, in the Developer Tools in IE or Firebug, make sure that all of your files are loaded into the browser.


2

make HTTPRequest to entered url and parse received HTML for FAVICON url value if any; then use extracted favicon url to display associated image


2

Here is the script is working fine for me I found it from below link and did some modification. http://social.technet.microsoft.com/Forums/en-US/sharepoint2010customization/thread/02f1d451-aaca-4708-8171-fc6e4d24d7d6 $(document).ready(function() { // do stuff when DOM is ready $("#s4-leftpanel-content ...


2

Yes you can. This is done easily by adding the jQuery snippet to the first item the XSLT spews out only. In your ContentQueryMain.xslt find the template OuterTemplate.CallItemTemplate. It has a <xsl:choose> going on in it. In the <xsl:otherwise> clauss add the following: <xsl:apply-templates select="." mode="itemstyle"> ...


2

Create a new calculated column in the list and enter the following formula: =[ColumnName1]&" "&[ColumnName2] I should add that you can use the calculated column to many things, please see this article for further use: Calculated Field Formulas Edited What you could do is to customize your listform in InfoPath. In this particular case you would ...


2

Chrome does not respond to enter key because this event is associate to the href attribute, so I put my javascript inside the href //Datepicker jquery ui function ImproveDateTextBoxs() { $("img[id*=DatePickerImage]").closest(".ms-dtinput").remove(); $(".ms-dtinput input[id$='Date']").each(function () { ...


2

I just did something similar for SharePoint 2013 but I'm pretty sure this works for 2010 as well. You can pass in special query string parameters to your views on a list, namely FilterFieldN, FilterValueN, and FilterOpN (where N is a number between 1 and 10). Example: ...


2

I do things a little differently with my JSOM code. I have a generic function and use deferred variables. Here is a working example that I used CDNS for. You should be able to drop this into a page and it will show a fullcal(although not with some of the other functions you defined) <script ...


1

Hi i have just put up a fiddle for you,updated fiddle hope that helps SCRIPT $('#mycalendar').fullCalendar( { header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, dayClick: function( date, allDay, ...


1

Thank you, Ransher. Now it works by using your tip: function GetCurrentDisplayedMonth() { var date = new Date($('#myCalendar').fullCalendar('getDate')); var month_int = date.getMonth(); return month_int; } --Added code block


1

it is essential for jquery ui that it is loaded AFTER jquery. In my experience in most cases this is the problem. To load your scripts at a specific time, try this approach: http://josharepoint.com/2015/06/16/custom-javascript-function-loaded-after-the-ui-has-loaded-in-sharepoint-2013/ ExecuteOrDelayUntilScriptLoaded could help you combined with lazy ...


1

Try to put your function into OnPostRender like this: SPClientTemplates.TemplateManager.RegisterTemplateOverrides({ OnPostRender: function(ctx) { as described here: CSR and form templates and here: Modifying ListForm Save & Close button through JsLink


1

There are a number of ways to handle this, but here is one: Create a solution package that deploys the files directly to _layouts. Put each version in a separate folder, for example _layouts/jQuery/1.11.1/ and so on so you can introduce new versions without breaking solutions built on older versions. As far as referencing jQuery in your pages, you can add ...


1

You don't need to reinvent the wheel I believe. From your requirement we can easily achieve using HTML Form webpart. And then connect it to a List View webpart for filtering. https://support.office.com/en-us/article/Use-the-HTML-Form-Web-Part-to-filter-and-display-data-in-another-Web-Part-860b681c-38ad-43ff-a036-a60868497ff7 The good thing about this ...


1

Try updating click event as follows $("#btnGetResults").click(function () { ShoutoutDataSub = []; Name = $('#txtEmp').val(); fromDate = $('#ShootOutfrmDate').val(); GetReports(Name, fromDate); });


1

Found the solution. All it took was replacing this bit of code: var h3 = '<h3>' + oListItem.get_item('Title') + '</h3>'; var div = '<div>' + oListItem.get_item('Floor') + '</div>'; var content = $(h3 + div); content.appendTo("#accordion").show(); with this bit of code var newDiv = "<h3> " ...


1

This is a broad question and there are multiple ways to approach it. First, you need to decide where to get the "associated information". If it's just a couple fields, you could consider loading it within the data view. If it is a bigger chunk (e.g. includes images), then you'll load it on demand with an AJAX call when the user selects an item. [Edit] ...


1

You can bind a click event to an image using jQuery in the same way as you would with any other element (though this really isn't a SharePoint question): jQuery('yourselector').click(function() { console.log('Image clicked.'); }); If you're trying to read and compare list data, you should read up on SharePoint's JavaScript Client Side Object Model.


1

You can read listitem properties from following code: function retrieveListItems(siteUrl) { var clientContext = new SP.ClientContext(siteUrl); var oList = clientContext.get_web().get_lists().getByTitle('Announcements'); var camlQuery = new SP.CamlQuery(); camlQuery.set_viewXml( ...


1

I ran into a similar scenario where I had to set specific authors, since you included a powershell code sample here is the powershell I used to make the changes. Be aware this goes through all posts and asks if you want to change the author on each one. It also changes the editor as well. Please take the time to read the script before using, and be sure to ...


1

I usually use a variant similar to what eirikb describes in his comment: if(typeof jQuery == 'function') NotifyScriptLoadedAndExecuteWaitingJobs("jquery.js"); else if (LoadSodByKey('jquery.js', null) == Sods.missing) RegisterSod('jquery.js', '//code.jquery.com/jquery-1.11.0.min.js'); SP.SOD.executeFunc("jquery.js", "jQuery", function () { ...



Only top voted, non community-wiki answers of a minimum length are eligible