Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use a sprite for my jQuery datepicker icon?

the ButtonImage is the property you specify for the icon but I want to use a sprite as the toggler - I can use buttonText and style the <button> element with a bg image but it probably wouldn't render properly in IE.. is there a way I can specify the exact HTML used for the button without having a button element rendered?

like image 826
meder omuraliev Avatar asked Feb 23 '10 17:02

meder omuraliev


1 Answers

You can use the following code:

html:

<input class="date-picker" id="date"/><span class="icon">Hello</span>

js:

$(".icon").click(function(){
    $(".date-picker").focus();        
});

OR

$(".icon").click(function(){
    $(".date-picker").datepicker("show");        
});

to trigger the datepicker with arbitrary code. here's a demo on jsFiddle

like image 137
JKirchartz Avatar answered Oct 01 '22 17:10

JKirchartz