Reputation: 1270
.calendarList {
background-image: url('/resource3/hpsc/common/images/calendar.png');
background-position: 135px 50%;
background-repeat: no-repeat;
cursor:pointer;
}
<input type="text" id="toDatepicker" class="calendarList" name="searchEndDate" size="20" >
Here the css class is applying totally to input text fields, when mouse over on text field, the cursor is showing hand symbol total input field, I what to show the hand symbol for that image only not for whole text field.
Upvotes: 0
Views: 581
Reputation: 2807
I don't think it's possible what you're trying to do.
Maybe you can add the image as a regular image (not as bg) and use some position: absolute and z-index to place it behind or in front of the textbox.
Upvotes: 2
Reputation: 33163
I suppose you could make it happen with JavaScript, but it would be quite a convoluted solution. It's easier if you make the image a label instead of a background picture and position it on top of the input field.
<input type="text" id="toDatepicker" class="calendarList" name="searchEndDate" size="20" >
<label for="toDatepicker" id="datepickerLabel>
<img src="/resource3/hpsc/common/images/calendar.png" />
</label>
CSS:
#datepickerLabel {
position:relative;
left:-20px;
cursor:pointer;
}
See http://jsfiddle.net/tNwTz/ for a demo.
Upvotes: 0