Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8909211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:22:28+00:00 2026-06-15T03:22:28+00:00

Hi guys I have a user control: <input type=text id=datepicker runat=server readonly=readonly /> <img

  • 0

Hi guys I have a user control:

<input type="text" id="datepicker" runat="server" readonly="readonly" />
 <img src="../images/remove.png" id="test" onclick="ClearFeild()" runat="server" />

My aspx page looks like this:

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolderBody" runat="server">

    <uc:Calendar ID="calSample" runat="server" ChangeMonth="false" ChangeYear="false"
        DateFormat="dd-M-yy" TextBoxWidth="75px" Enabled="true" />
    <uc:Calendar ID="Calendar1" runat="server" ChangeMonth="false" ChangeYear="false"
        DateFormat="dd-M-yy" TextBoxWidth="75px" Enabled="true" />
</asp:Content>

And on the user control I have a javascript function that gets called on the img onclick:

    function ClearFeild()
    {     
       debugger; 
       $("#<%=datepicker.ClientID %>").val() = "";
    }

but the value of

$(“#<%=datepicker.ClientID %>”);

is always :

$(“#ContentPlaceHolderBody_Calendar1_datepicker”);

which is the second user control, even though i click on the first control.

PLease assist as to how i can over come this.

The CLearFeild function gets called on a button click to clear the datepicker feild.

Kind regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:22:29+00:00Added an answer on June 15, 2026 at 3:22 am

    You need to pass the source object to your function

    Live Demo

    onclick="ClearFeild(this)"
    
    function ClearFeild(source) {        
        obj = $('#' + source.id)
        prevInput = obj.prev('input[type=text]')
    }​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How have you guys handled working with jQuery includes <script type=text/javascript src=jquery.js></script> in Asp.Net
guys i have arrays in which i have to match this kind of text
I have a ComboBox that has an associated ErrorProvider in the user control it
hie guys. I have ParentPage which contains 4 user controls and i have user
I have a winforms app that uses a UserControl. The user control's job is
do you guys have any idea how to edit the the labels in the
Thus far you guys have been wildly helpful with me getting this little ditty
Python list comprehensions are nice, but near impossible to debug. You guys have any
Guys I have an activity which has a home button, when the button is
guys I have two question to ask, they're easy, but bothering me for a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.