jquery - How to let the Javascript run at the last process in a page with Javascript -
I have a problem that when my page loads, my javascript runs and loads JS calendar of my JS after. Thus, my JS JS does not affect calendar.
1.Page weight
2.My JS runs
4.JS calendar starts
What do I want here? > JS runs after calendar Some have suggested using me on
() but I do not know whether this is the best solution or There are other solutions.
JSFIDDLE works very well down the browser but it does not work with SharePoint 2010.
HTML:
& lt; Div id = "asynchronousViewDefault_CalendarView" & gt; & Lt; div class = "ms-acal-header" & gt; & Lt; Div & gt; & Lt; Table class = "MS-ARM-month" & gt; & Lt; / Table & gt; & Lt; Div class = "ms-acal-vlink" & gt; & Lt; Table & gt; & Lt; Tbody & gt; & Lt; TR & gt; & Lt; Td> & Lt; A href = "javascript: zero (0)" title = "add" evtid = "new_item" & gt; & Lt; Img border = "0" src = "/ _ layout / image / caled .gif" & gt; Add & lt; / A & gt; & Lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt; / Div & gt; Javascript:
$ (document) .ready (function () {var abc}
= $ ("# AsynchronousViewDefault_CalendarView"). ('A [Title = "Add]" [evtid = "new_item"]. Hover (function () {$ (this) .attr (' href ',' http: // Share / lists / calendar.aspx? P = P1 ');});}); JSFIDDLE:
I have tried with jQuery
() but it does not work with my SharePoint 2010:
$ ("#synchronousViewDefault_CalendarView div div table") .on ("click", function () {var abc = $ ("# AsynchronousViewDefault_CalendarView"). Then ('a [title = " Add "] [evtid =" new_item "]. Hover (function () {$ (this) .attr ('href', 'http: // share / list / calendar .aspx? P = p1');}) ;});
or
$ ("#synchronousViewDefault_CalendarView") .on ("click", '.ms-acal-vlink', function () { Var abc = $ ("# asynchronousViewDefault_CalendarView"). ('A [title = "add"] [evtid = "new_item"]). Hover (function () {$ (this) .attr (' href ',' http: //share/List/Calendar.aspx?p=P1 ');});});
This is my solution, please tell me if it does not work with you SharePoint or anything could be wrong: -).
$ (document) .on ("click", "#synchronousViewDefault_CalendarView .ms-acal-vlink", function () {var find_aTag = $ (("Asynchronous ViewDefault_CalendarView"). (' A [title = "add"] ')); find_aTag.attr ("href", "http: //share/Lists/Calendar.aspx?p=P1");});
or MdMazzotti method
_spBodyOnLoadFunctionNames.push ("spReady"); Function spReady () {$ ('. S4-ba'). ('Click', '.ms-acal-item a', function () {console.log ('clicked');}); }
Comments
Post a Comment