开发者

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

开发者 https://www.devze.com 2022-12-20 20:56 出处:网络
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

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 eleme开发者_运维技巧nt rendered?


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


Ended up just specifying a png.

0

精彩评论

暂无评论...
验证码 换一张
取 消