开发者

Why i am getting multiple images while using Function() in jquery

开发者 https://www.devze.com 2023-03-09 03:05 出处:网络
I use the following Jquery for calendar http://keith-wood.name/datepick.html My source is as follow <script type=\"text/javascript\">

I use the following Jquery for calendar http://keith-wood.name/datepick.html

My source is as follow

<script type="text/javascript">
$(function()
{
$('#ctl00_ContentPlaceHolder1_textbox1').datepick({showOnFocus: false, showTrigger: '#calImg'});
});
</script>

<asp:TextBox ID="textbox1" runat="Server">
</开发者_StackOverflow中文版asp:TextBox>
<img src="calendar.gif" alt="Popup" id="calImg" class="trigger" />

But i am getting multiple images when i see on my browser why this is happening

Link http://i53.tinypic.com/2v0ykd1.png


I don't know how this plugin works internally, but you can see in the example ( http://keith-wood.name/datepick.html -> Invocation -> From image only) that they hide the original image:

<div style="display: none;"> 
    <img id="calImg" src="img/calendar.gif" alt="Popup" class="trigger"> 
</div>


For some reason the datepick-plugin clones the image. Possible workaround is to just remove the image after loading the datepicker.

<script type="text/javascript">
$(function()
{
$('#ctl00_ContentPlaceHolder1_textbox1').datepick({showOnFocus: false, showTrigger: '#calImg'});
$("#calImg").remove();
});
</script>
0

精彩评论

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