tags:

views:

280

answers:

1

Hi,

I am using jquery datepicker, please see below code

$(document).ready(function() 
{        
    $(".txtDate").datepicker({
    showOn: 'button',
    buttonImage: '../images1/calendar.gif', 
    buttonImageOnly: true,
    dateFormat: 'dd/mm/yy',      
    showOtherMonths: true,
    showStatus: true,
    onSelect:function(){}
    });

});

And the code which is generated after using datepicker is below:

<td class="gridWidth175">
    <input type="text" class="txtDate hasDatepicker" id="ctl00_ContentPlaceHolder2_txtFromSearchDate" name="ctl00$ContentPlaceHolder2$txtFromSearchDate"/><img class="ui-datepicker-trigger" src="../images1/calendar.gif" alt="..." title="..."/>
    <input type="text" class="txtDate hasDatepicker" id="ctl00_ContentPlaceHolder2_txtToSearchDate" name="ctl00$ContentPlaceHolder2$txtToSearchDate"/><img class="ui-datepicker-trigger" src="../images1/calendar.gif" alt="..." title="..."/>                              
</td>

Now If you see there is blank "alt" and "title" I want to give alt text as well I want to add "align='absMiddle' so before it gets render on the page my img tag will be like below:

<img class="ui-datepicker-trigger" src="../images1/calendar.gif" alt="Select Date" title="Date" align="absMiddle"/>

Please help!

+1  A: 

You can add those attributes manually after initializing the datepicker:

$('.ui-datepicker-trigger').attr('alt', 'Select Date').attr('title', 'Date');

As for align attribute, I would set it somewhere in CSS stylesheet instead of JavaScript.

RaYell
Many Thanks Rayell for your help!
MKS