Cargar JQuery en el navegador de forma dinamica

Sirve, por ejemplo, para cuando queremos probar nuestro código javascript en JQuery pero la página no tiene la librería cargada. Ejecutamos este código primero en la consola del navegador y la cargará: (function(){ var newscript = document.createElement('script'); newscript.type = 'text/javascript'; newscript.async = true; newscript.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'; (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(newscript); })();

Crear notificaciones nativas de SharePoint en código cliente

Crear notificación propia de SharePoint: var notifyId = ''; notifyId = SP.UI.Notify.addNotification("Hello World!", true); El primer parametro es HTML (podemos personalizarlo). El segundo parametro es para que desaparezca: "true" hará que se mantenga hasta que clickemos sobre él, "false" hará que desaparezca al cabo de unos segundos. notifyId tendrá el identificador, que nos servirá para …

Sigue leyendo Crear notificaciones nativas de SharePoint en código cliente

Disable input ENTER key in Chrome, FireFox, IE (including IE8), etc. by Javascript & JQuery

In order to disable the ENTER key in your textbox type input, you have to add the 'onkeydown' attribute and call a javascript function that checks the key and avoid to submit the form when you press ENTER key. Input example <input name="myName" type="text" value="Search" onclick="eraseInitialText(this);" onkeydown="disableEnter();"> Javascript function function disableEnter() { var key = …

Sigue leyendo Disable input ENTER key in Chrome, FireFox, IE (including IE8), etc. by Javascript & JQuery

Hide «div» that contains a specific «div» in one of its children (at any level)

We want to hide "Level1" div that contains inside any "Level3" div in this code: <div class="level1"> Level 1A <div class="level2"> Level 2A <div class="level3"> Level 3A </div> </div> </div> <div class="level1"> Level1B <div class="level2"> Level2B </div> </div> We can do it by JQuery, once the page is loaded, that way: <script type="text/javascript"> $(document).ready(function(){ hideLevelOne(); …

Sigue leyendo Hide «div» that contains a specific «div» in one of its children (at any level)

Hide Elements List in ‘Details View’ and See Only its Properties in SharePoint

If you want to use the details view on a list or library and you don't want to see the list of elements (maybe you need to show only one item, or you're going to select that item on another webpart) you can hide it doing the following: 1. Edit Page. 2. Create a new …

Sigue leyendo Hide Elements List in ‘Details View’ and See Only its Properties in SharePoint

Pasar y Obtener Parámetros de la URL

Para pasar parámetros a través de la URL nos basta con añadir un "?" al final e ir insertando los parámetros que queramos con el patrón "nombre=valor" y separados por un "&", quedando del siguiente modo: Javascript: var URL = 'myweb.aspx?param1=1&param2=2&param3=3'; C#: String URL = "myweb.aspx?param1=1&param2=2&param3=3"; Si lo que queremos es obtener estos parámetros posteriormente, …

Sigue leyendo Pasar y Obtener Parámetros de la URL