Confirmbox with custom button text - javascript

when we use confirm prompt box , it always display "ok" and "cancel" buttons
I want to change the label text for the ok and cancel buttons as Agree and Not Agree
please do suggest any solution

What i can suggest you is apply or override CSS; which i think is not at all a better solution.
Next you can go with following link posted below.
JavaScript confirm box with custom buttons.
Hope this helps.

Related

how to change the default labels of jquery alert box

I want to change default button labels "ok" and "cancel" of jquery alert box to "delete" and "trash" can we do that without the use of any custom modal or boxes because i have seen some example around like "stay" and "leave" etc. Please help
You cannot override the appearance of the alert box. You can, however, create your own using jQuery's Dialog.

Text box with a clear button inside in asp.net

I have a lot on my site text boxes whose content is a date
So I will not have to check correctness did it read-only
Until now next to each text box was two buttons, one to add date opened popup calendar, second to delete the date (values ​​not required)
Now I wanted to go to ajax calendarextender that the buttons were just ugly
My problem is that this control is not have delete button, and I do want to allow the user to deleted but not cancel the properties read-only to text box And I do not want to leave the ugly button.
My question:
If calendarextender ajax or something similar with a delete button from the popup
Alternatively if you have the option text box with a delete button inside( as text boxes IE10)
With the help of css and java-script you can easily do it.
Here is an example How do I put a clear button inside my HTML text input box like the iPhone does?
Instead of all that work to make it read-only and avoid validation, why not combine a FilteredTextBoxExtender with the CalendarExtender. Use the filter to block all non-numeric characters. I still think it's better to do the validation. It's as simple as DateTime.TryParse(), or you could do it client-side with the built-in FieldValidators.

How to use javascript to edit HTML content?

I have a section in my website where a user can type an answer to a Question. For example the questions states:
Movie I have watched the most times:
Answer: Wedding Crashers
I have an edit button next to the question. When the user clicks on the edit button I want the website to open up a text-box with Wedding Crashers in it in the same place as the original answer box. The user can edit the answer and change it to another movie. There should be a save and cancel button below the text-box. Once the user changes the answer from Wedding Crashers to another movie and clicks save, the text-box disappears and the new answer is displayed on the website. For now I only want to be able to edit the hard-coated HTML content. I will connect to a database later and put a query to update the users database as per his/her answer. I think it is something to do with javascript and the CSS properties of display:block and display:hide. Can anybody help?
Seeing you other question relate to Rails, you can use an edit-in-place solution such as
https://github.com/bernat/best_in_place
is that what you need?
Whoa! Clicking edit button sounds like 1999 for me ...
Did You consider using plain text input (with proper styling, no border etc.) that will appear as editable on hover/focus? You still need a bit of javascript to send a request on enter (AJAX for better UX or normal POST when js is disabled) and remove focus from the field. I do it this way at my work. It works really well.
you can use something like this:
document.getElementById('someid').innerHTML = 'Fred Flinstone';
and for changing CSS properties:
document.getElementById('someid').style.borderWidth = '4px';
Is the textbox absolutely necessary?
You can use the wonder of HTML5 (http://html5demos.com/contenteditable) for browsers that support it.

Custom Confirm Form by jQuery

Now I use return confirm(Message); when need confirmation in a form. that cause displaye a form with two button OK and Cancel. Is there any way to change the buttons text in displayed form? I need to change buttons to another language? what is your suggestion?
Since you tagged jquery, jQuery UI Modal Confirm is definitely worth a look
Working fiddle: http://jsfiddle.net/naveen/GR2UT/
You can't change the button text on a native confirm box. You can program your own modal dialog, which would give you control to what's in the buttons. In this jsfiddle you'll find a plain javascript example. Or use JQuery, like naveen suggested.

How does stackoverflow implement the Title box so that it hides the text when you type?

On the "Ask Question" page, the text in the Title box says "What's your programming question? be specific.". When you click on it, the text remains, but when you type anything it goes away.
How is this implemented? I'm looking through the script and failing to find the code that hides this overlay text.
You could use the onkeydown method. Check to see if the current text is equal to the default text and if so get rid of it. Then use the onkeyup method to check to see if the field is empty and set back to default.
Watermark is a very nice jquery plugin that handles this for you. It will also intercept form posts and remove the watermark text if nothing has been entered which aids validation and submission.
If you prefer not to use jquery you can find a javascript/css only solution at http://www.codeproject.com/KB/aspnet/WatermarkTextBox.aspx

Categories