PHP get first day of current month, datepicker friendly

December 22, 2014

The simplest and readable way to do it is using this clean solution. All you need is a string represent the date. First day of the month: Last day of the month:

Javascript toggle show/hide div or anything

October 14, 2014

You would manipulate the elements by toggling between styling rather than changing the elements based on the innerHTML. In this case, you would toggle between display:none and display:block. Example:

jQuery(…).datepicker is not a function

October 7, 2014

The are several reasons for this error: 1.The jquery.ui is used before jquery. 2.The $ is used by another library. 3.The jquery lib that is referenced locally(wordpress) has different version from that using jquery.ui. 4.When the right library and version is referenced the browser cache must be cleared.

jQuery get which radio is selected

August 22, 2014

Use the :checked selector along with the radio selector. With form id, can do this Without form is, it will still work:

jQuery handle null value in PHP variable or array

August 6, 2014

Handling php array or variable inside javascript directly using json_encode, will result some value null. To check null using jquery in this case:

jQuery select list set selected using php variable

August 6, 2014

Using jQuery to set the selected element of the select control to be the item with the text description. Value from php.

jQuery Datepicker does not work in dynamic element

August 5, 2014

This always happen when bind the event initially, the new field doesn’t exist. A better way is initialize the datepicker for the field when create the element. Example after an AJAX call to build the fields:

jQuery add attribute to html element and remove

July 25, 2014

You can add attributes using attr like below: To remove: However, for DOM properties like checked, disabled and readonly, the proper way to do this (as of JQuery 1.6) is to use prop. To remove:

jQuery checkbox checked state changed event

July 25, 2014

Bind to the change event instead of click. However, you will probably still need to check whether or not the checkbox is checked: Example below shows and hide a div when checkbox checked or unchecked

Jquery read element attribute id with square brackets [ ]

July 16, 2014

To use any of the meta-characters ( such as !”#$%&’()*+,./:;?@[\]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\. For example, an element with id=”foo.bar”, can use the selector $(“#foo\\.bar”). Example: Reference: Special Characters In Selectors