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 3615822
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:25:16+00:00 2026-05-18T22:25:16+00:00

i have a text-box in my tree that is generated run-time for giving the

  • 0

i have a text-box in my tree that is generated run-time for giving the user to enter the node in the textbox i have given a water-marker message to enter something on the click function of textbox i have cleared the textbox but on the key press event also i want the text to be cleared but not able to do it i have pasted my code

function CreateTextBoxNode(SpnPrntId) {
var elem = document.createElement("input");
elem.type = "text";
elem.id = "txtParent";
elem.value = "Enter node name";
$(elem).css("color", "DarkGray");
elem.setAttribute('onblur', 'SetSpanValueForParent("' + SpnPrntId + '")');
$(elem).keypress(function(e) {
    SetEnterValue(SpnPrntId, e);
});
$(elem).click(function() {
    textClick();
});
$(elem).focus(function() {
    textClick();
});
return elem;

}

function SetEnterValue(prntID, e) {
var key = checkBrowser(e);
if (key == 13) {
    SetSpanValueForParent(prntID);
}

}

function textClick() {
$(“#txtParent”).val(”);
}

On key press when enter is pressed i have to append the value into some span i also tried its focus function so when the first time the textbox come with focused set it removes the message.

  • 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-05-18T22:25:17+00:00Added an answer on May 18, 2026 at 10:25 pm

    I think it would be a lot easier for you to use a placeholder which will work in many modern browsers (Firefox, Chrome, Etc), and then maybe a jquery plugin to make it work with the incompatible browsers.

    Here’s another really simple version
    https://github.com/brandonweiss/jquery-placeholder

    I’ve used this approach in my web apps and it works great. The best part is the reusability of it. Every time you need a watermark, you simply add the placeholder tag to your input and you’re done.

    <input placeholder="Enter a valid email address" name="email" id="email" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have text box in that user have to enter only text. user shouldn't
I have text box to enter a phone number. I'm using AJAX MaskedEditExtender and
i have form where i have text box value and link (add). when user
I have a text box which accepts time in the format HH:mm and entries
I have a text box that is going to be populated with a comma
I have a text-box, and I want to enter a string in language A
On UI I have a TextBox. I want to show Tree element when user
I have a Flex movie that contains a text input box and an (optional)
I have text box in which your adds values in comma separated values. Once
I have a text box with a certain width and a string. How do

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.