Posts

How to get title from IFrame document

HTML code :   < div id = "main-content" > < iframe name = "cstage" src = "home.html" width = "100%" height = "100%" id = "main-content-iframe" frameborder = "0" > If you 're seeing this message, it means IFrames are not supported; Please enable IFrames or upgrade to a compatible browser that supports IFrames.</iframe> </div> jQuery code:   alert($(' #main-content-iframe').contents().find("title").text());     Note: Make sure home.html come from the same domain as your main page.

How to Disable Theme and Plugin Editors from WordPress Admin Panel

By default WordPress allows users to edit the theme and plugin codes through the admin panel. While it is a handy feature, it can be very dangerous as well. A simple typo can end up locking you out of your site unless ofcourse you have the FTP access. To prevent clients from screwing up the site, it is best to disable the theme and plugin editors from the WordPress admin panel. In this article, we will share with you a one line code that will disable theme and plugin editors functionality from WordPress. All you have to do is open your wp-config.php file and paste the following code: define( 'DISALLOW_FILE_EDIT', true ); 1. Removing theme editor link from menu using remove_action() function tcb_remove_editor_menu() { remove_action('admin_menu', '_add_themes_utility_last', 101); } add_action('admin_menu', 'tcb_remove_editor_menu', 1); 2. Removing theme editor link from menu using remove_submenu_page() add_action('admin_i...

Preventing form submission when Enter is pressed

$('input').keydown(function(event){             if(event.keyCode == 13) {                 event.preventDefault();                 return false;             } });

How to detect a click outside an element?

Attach a click event to the document body which closes the window. Attach a separate click event to the window which stops propagation to the document body. $('html').click(function() { //Hide the menus if visible }); $('#menuele').click(function(event){     event.stopPropagation(); });

How to replay a swf movie on jquery button click

1. Embedded flash movie <object data="http://wwwimages.adobe.com/www.adobe.com/multimedia/en_us/get/flash/flash_installed_728x170.swf" type="application/x-shockwave-flash" id="flash_99674493" width="680" height="316">     <param name="movie" value="http://wwwimages.adobe.com/www.adobe.com/multimedia/en_us/get/flash/flash_installed_728x170.swf">     <param name="wmode" value="opaque"> </object> <a href="javascript:restart();">Restart swf</a> 2. jQuery var restart = function() {    var flashObject = jQuery("object");    var flashOriginal = flashObject.html();    var flashSrc = flashObject.attr('data');    flashObject.find('param').remove();    flashObject.attr('data',flashSrc);          flashObject.html(flashOriginal); } Working Demo

How to build a HTML 5 video playlist

1. HTML <video id="videoarea" controls="controls" poster="http://html5videoformatconverter.com/data/images/screen.jpg" src="http://html5videoformatconverter.com/data/images/happyfit2.mp4"></video> <ul id="playlist">     <li data-url="http://html5videoformatconverter.com/data/images/happyfit2.mp4" data-poster="http://html5videoformatconverter.com/data/images/screen.jpg">Happy Fit</li>     <li data-url="http://grochtdreis.de/fuer-jsfiddle/video/sintel_trailer-480.mp4">Sintel</li>              <li data-url="http://html5example.net/static/video/html5_Video_VP8.webm">Resident Evil</li>          <li data-url="http://www.ioncannon.net/examples/vp8-webm/big_buck_bunny_480p.webm">Big Buck Bunny</li> </ul> 2. CSS <style type='text/css'>     #playlist {   ...

HTML5 video loop src change on end play function

1. HTML <video id="homevideo" width="100%" autoplay onended="run()">     <source src="http://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4" /> </video> <ul>     <li>http://www.w3schools.com/html/mov_bbb.mp4</li>     <li>http://www.w3schools.com/html/movie.mp4</li> </ul> 2. CSS <style type='text/css'>     ul {         display:none;     }   </style> 3. jQuery <script type="text/javascript"> video_count = 0; videoPlayer = document.getElementById("homevideo"); function run(){    video_count++;     var countVideo = $('li').length;         if (video_count == countVideo) video_count = 0;        var nextVideo = $('li').eq(video_count).text();         videoPlayer.sr...