I need some help with jQuery script again 🙂 Just trying to play with jQuery..I use script below for coloring options of select element. It works in pure html, but in my asp.net 2.0 (Master + Content pages) does not. Script is placed in Head section.
function pageLoad(){ var allOddSelectOption = 'select option:odd'; var evenStyle = 'background-color:'#f4f4f4';color:'#555''; $(allOddSelectOption).attr('style',evenStyle); }
I tried also use $(document).ready(function(){ but it didn’t work too.
Any ideas, tips most welcome?
Check css(properties), you can apply styles very easy.
EDIT: For ASP .NET 2.0
$(document).ready()will work, since you can call it multiple times you will have no problem even if it’s not in the head section.For ASP .NET 3.5
You can add in your MasterPage a head placeholder like this:
and then in your child pages you can put html into it by a Content tag: