Javascript how to alert view array or object
April 14, 2014
Easiest way is using .toSource() alert(arrayObj.toSource());
jQuery get id of last div inside a div
April 8, 2014
The correct way to get the id of the last child div inside parent container using jQuery: Or
jQuery check if element exist
March 17, 2014
To check the length of the selector, if it returns you something then the element exists else not exist. Use:
jQuery get checkbox value
March 12, 2014
You can I get a checkbox’s value in jQuery like this if you have set a class or id for it Without id For some reason: •$(‘#checkbox’).val() always returns on •$(‘#checkbox’).is(‘checked’) always returns false But, Returns the right checkbox state. Other way of retrieving checkbox’s value is
jQuery remove validation rules by event
March 12, 2014
You could use the rules(‘remove’) method to remove your rules dynamically. Something like this on any event. Use rules(‘add’) method to add the rules back just before submit example:
How to convert php array to javascript array
March 11, 2014
You can convert php arrays into javascript using php’s json_encode()* function: Example: To use the array, remember do JSON.parse(): To use the array, jquery $.each is easy to loop and retrieve the information:
jQuery find thead element of a table
March 5, 2014
Use .find() Hide a thead element after found: Remove a thead element after found
jQuery datepicker to show month and year only
February 21, 2014
In reporting specially, datepicker with month and year only are a better way to provide information to form for submission without need of the day. In my case, I modified one picker $( “#month” ).datepicker to fill both month and year input field
jQuery call same on click function of elements having same ids
February 17, 2014
You cannot have multiple ID’s in your HTML markup. It would be an invalid markup. When querying for $(‘#foobar’) and there are five elements which have that id, you would only get the first instance. So even if there would be a way (…) to apply code to all of those nodes, don’t do it. […]
Recent Comments