Enhancing Watermark Functionality for Text Boxes

I am encountering an issue with three textboxes all having watermarks. When I use JavaScript to set the value of the second textbox in the OnChange event of the first textbox, the text appears as a watermark. However, when I click on the textbox, it becomes empty, and upon leaving, it reverts back to the original watermark text.

Is there a way to have the text set by JavaScript display as the entered text rather than the watermark text?

Answer №1

This method may seem unorthodox, but it is effective. Utilizing the extender's set_Text function is crucial to ensure that your text is recognized as such, rather than mistaken for a watermark.

<!-- Avoid this: -->
onchange="document.getElementById('<%= textbox.ClientID %>').value = 'foo'"

<!-- Use this instead: -->
onchange="$find('<%= watermark.ClientID %>').set_Text('foo')"

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilizing custom filters to navigate through nested ng-repeats

My goal is to achieve a specific behavior by using custom filters. I am working on creating a unified search bar that will display entire group names with all failing students, as well as group names with only the matching students. If you want to see the ...

The template failed to load on AngularJS post-compilation

Following the build of my Angular app, I encountered this error message: [$compile:tpload] Failed to load template: app/app.html (HTTP status: 404 Not Found). Seeking assistance from you all!!!!! app.html <div class="root"> <div ui-view> ...

Interacting with the server dynamically: JSF and Richfaces AJAX calls

Within a Tabpanel, each Tab's content is initially loaded from the server through ajax with the "switchType=ajax" attribute, preventing all content from being fetched at once. Once retrieved, the content should not be fetched again as it already exist ...

Unable to successfully upload a .docx file within OnlyOffice utilizing JavaScript

Our application has successfully integrated the OnlyOffice editor. I am currently facing an issue while trying to upload a .docx file from my PC to the OnlyOffice server for later editing. Despite sending a POST request to the server using formdata, the fu ...

Searching Text Files Using PHP Based on User Input

I am in search of a way to check through a list of Zip Codes that we serve. We possess a text file filled with zip codes for the areas we cover. I would like to include a form on our website where users can input their zip code to determine if we provide s ...

Dynamic form validation using jQuery

I am facing a challenge with validating a dynamic form on the user side. My goal is to ensure that if a user fills out one column in a row, they are required to fill out the remaining columns as well. For example, filling out the CC # should prompt the use ...

"Encountered an issue with ng-annotate during processing

I'm attempting to utilize ng-annotate on my Angular application, but it seems to be not working at all. Here is the configuration part: (function () { 'use strict'; angular.module('app') .config(/*@ngInject*/ ro ...

Challenges in using HAML5 Canvas for mathematical applications

Hey there! I'm currently working on utilizing the canvas element to form various shapes, but I've encountered a few challenges when it comes to the mathematical aspect. Issue 1: I need to calculate an angle that is relative to the preceding line ...

Issues with locating elements using jQuery within an AJAX request

I need assistance setting up AJAX pagination using jQuery. The code I'm trying to use is as follows: $('.pagination a').on('click', function(e) { e.preventDefault(); $.ajax({ type : 'GET', ...

Is there a way to dynamically register an external component in Vue3 without altering the main project?

In my current project, known as "ProjectMain," I am also working on another project that will act as an extension to ProjectMain - let's call it "MyComponent." My intention is to create MyComponent as a standalone library. My main question is: can I ...

The system is unable to locate a compatible object with the identifier '[object Object]' of type 'object'. NgFor is limited to binding with iterables like Arrays, not JSON data

Working with JSON data data:[ { assets:[[tool_order_id: "38",order_status_id: "10"]], order_info:[id: "1", order_type: "6",check: "1", current_Stage_id: "29"] }, { assets:[tool_order_ ...

Modify the indentation format in CSS/JS

When the Tab key is pressed in an HTML page and the tabbed link gets highlighted, is it feasible to customize the style of that highlight? ...

Prototype: Trigger keydown event on the document and cease observation when focus is on a form

I'm implementing next/previous page functionality with AJAX and left/right arrow keys (similar to Facebook). It's all working fine, but I have a form on the page. When a user focuses on the form, I need to stop listening for left/right key presse ...

Customize JqGrid Edit/Delete button CSS style

Within my JQGrid, I have successfully implemented Edit and Delete buttons that redirect users to another page for editing or deleting specific records. However, I am facing a CSS issue with the styling of these buttons. How can I override the current style ...

Validating Two DateTime Pickers as a Group with Javascript in asp.net

How to Ensure Group Validation of Two DateTime Pickers Using JavaScript in ASP.NET ...

"Clicking on the jQuery carousel dots results in always navigating back to the first item

Creating a carousel using basic jquery, utilizing the .css() rule to toggle opacity between slides. The goal is to have each dot trigger the display of its corresponding slide while hiding the others. Currently trying: $('.dot').click(function( ...

Retrieve the parent element of the selected tag within an iframe

I have an embed iframe that displays an HTML page. Now I am trying to retrieve the class of the parent item that was clicked. <iframe src="//example.com" id="frame" ></iframe> This is the CSS styling for the iframe: #frame{ width:380px; he ...

PHP effectively processes data even when the Ajax response is null

I created a form that sends a POST request to a PHP file on the server. The request is processed successfully, but when I attempt to access the response data, it appears as null. Here is my PHP code snippet: <?php header('Access-Control-Allow-Orig ...

"Use Highcharts to visually compare the data from one month in two different years

How can I use Highcharts Columns to compare data from two different years within the same month? Check out the example image below: https://i.sstatic.net/8MMsA.png The data structure is as follows: myData[0] = { data1:"0.00", data2:"0.00", data3:"868.0 ...

"Implementing Vue mousemove functionality only when the mouse button is pressed

Is it possible to initiate a mouse movement only after the element has been clicked first? I am exploring this functionality for an audio player timeline. .player__time--bar(@mousedown="setNewCurrentPosition($event)") .slider(role="slider" aria-valuem ...