Showing posts with label jquery. Show all posts
Showing posts with label jquery. Show all posts

Friday, December 5, 2014

How to define multiple CSS attributes in jQuery

I have been doing like this
$('#id).css('background-color': '#ffff00', );
$('#id).css('color', '#ff0000');

yes it works but Could be done like this using chaining 
$('#id).css('background-color': '#ffff00'.css('color', '#ff0000'); 



But still the better way is to do like this

$('#' + id).css({'background-color': '#ffff00','color': '#ff0000'});
#notice the curly braces Even better way is to simply change class of the element using jquery

Thursday, February 21, 2013

Jquery date picker z-index issue

In your css use

'.ui-datepicker{ z-index: 9999 !important;}'

Here 9999 can be replaced to whatever layer value you want your datepicker available.

Neither any code is to be commented nor adding 'position:relative;' css on input elements. Because increasing the z-index of input elements will have effect on all input type buttons, which may not be needed for some cases.