Snippets
Some little pieces of code that will help you solve your problems faster.
Drag and drop on mobile devices
Drag and drop on mobile devices I had a problem in the past with a draggable and droppable calendar with jQuery and ajax. When you add drag and drop to a web page using JavaScript, such as jQuery UI draggable and droppable, you obtain a problem. The dragging and dropping are intercepted by the phone
How to select all anchors with display block jquery
How to select all anchors with display block jquery Very often or not, you need to select all the elements from within the DOM, that have their display property set to “block”. Solution
1 2 3 |
$('a').filter(function (index) { return $(this).css("display") === "block"; }) |
Filter function from jQuery to the rescue. Description: Reduce the set of matched elements to those that match the selector or pass
Disable jqueryui calendar days EXCEPT the mondays of every week
Disable jqueryui calendar days EXCEPT the mondays of every week Let’s say you want the user to be able to see all days from within the month, but to be able to select only the mondays of every week.
1 2 3 4 5 6 |
$("#datepicker").datepicker({ beforeShowDay: function (date) { var day = date.getDay(); return [(day == 1)]; } }); |
Here is a DEMO. You can disable all “Sundays” by switching from “day == 1”
Disable temporary a foreign key constraint in MySQL
Disable temporary a foreign key constraint in MySQL Were you in the situation of having a mysql table and wanted to delete some records from it, but you were not allowed due to the constraints of that table? Don’t worry, me too. Or if you use foreign keys in your database tables, you’ll probably have problems