10
2013
Scroll to top
<a href="javascript:void(0);" onclick="jQuery(‘html, body’).animate( { scrollTop: 0 }, ‘slow’ );">Go to top</a> Or as a click handler: $(‘body’).on(‘click’, ‘.top’, function(){ $(‘html, body’).animate( { scrollTop: 0 }, ‘slow’ ); return false; });
10
2013
Disable right click
$(document).ready(function(){ $(document).bind("contextmenu",function(e){ return false; }); });
10
2013
Sum values of all checked radio buttons
//Sum the values of selected radio buttons and put into input $(‘body’).on(‘change’, ‘input’, function(){ //Start the sum counter var thisCount = parseInt(0); //Run through all the selected radio buttons var data = $.map($("input:radio:checked"), function(elem, idx) { thisCount = + thisCount + parseInt( $(elem).val() ); $(‘#totals’).val(thisCount); }); }); //To Compile non integer data into a string $(‘body’).on(‘change’, ‘input’, function(){ //Start the output var thisValue = ”; //Run through all the selected radio buttons and join with […]
9
2013
Prevent unwanted title tag display
//Prevent unwanted title tags from being displayed $(‘[title]’).each(function(){ $(this).data(‘original-title’, $(this).attr(‘title’)); }).hover( function () { $(this).attr(‘title’,”) }, function () { $(this).attr(‘title’,$(this).data(‘original-title’)) });
Recent Snippets
- htaccess : Only allow access to specific wordpress upload types if logged in
- MySQL : Query WordPress Database for Invalid Media Filenames
- PHP : Get Actual IP Address with PHP
- JavaScript : Allow Tab in Textarea
- PHP : Clean sanitized database contents on output
- htaccess : Force www. prefix in URIs
- PHP : Force File Download with Correct Content Type
- Wordpress : Disable upgrade notification