setting a value of ASP:Dropdown using jquery - jquery-ui

I am trying to set a value for DDL say
$('#ddlState').val("State"); //State matched the name in DD list value
i have this line in ready function and it works for text boxes but not DDL.
I am also using labelify plugin for text boxes but when i set values like
$('#txtBox').val("Some Value"); //Which is not same as title value
the some value is showing in the grey color.
Any clue?

Well for starters, .NET doesn't render the controls as
$('ddlState');
Try doing this:
$('#<% ddlState.ClientID %>').val('State');

Check out this answer:
Adding options to a <select> using jQuery?

Related

Bug when use value as children of TextInput [React Native]

I'm having some problems using component in React Native 0.70.2.
Specifically I need to put the text like this {children} , instead of passing a value prop, because I need to manipulate text for creating a mention text input.
Here's a video of what happen: https://user-images.githubusercontent.com/64473929/194781923-7a314cef-6522-424d-a085-9a70478bd390.MP4
Here's my code: https://snack.expo.dev/#pietroputelli/bbbed6
Is there any path to solve this bug?
Thank you.
You should add
onChangeText={(text) => {
setValue(text)
}}
Now it will only rerender the text once per keystroke.
If you change the value directly like you do, the state will update first when you enter a keystroke, then the component rerenders, and will set the state again with the value+value, which will trigger rerenders exponentially.

Is it possible to Html.Hidden a text by its id?

Is it possible to #Html.Hidden a text value by id?
In the next example someText changes in JS.
<div id="someText">1</div>
I would like to add hidden value that will get the div's text, is it possible?
For example:
#Html.Hidden("Position", GetTextById("#someText"))
Sure you can!
First, let's say you want to add the hidden value inside your html body... just append the whole thing using jQuery:
$(body).append('#Html.Hidden("Position",' + $("#someText").val() + ')');
Given that, if your goal is just to hide the value, you could do:
$("#someText").hide();
Regards,

Validation of date input into textbox when using JQueryUI Datepicker

I have a textbox that I've attached the datepicker to. If the user enters the date via the datepicker all is well but they also have the ability to go in and enter a bad date directly into the textbox. i.e. 1/55/1995
Can the text box be disabled so only the calendar can be used?
How are people preventing this?
Looks like what you need is to just disable the field or make it readonly. Check out this answer How can I disable all keyboard keys?
I would say readonly is the better option because it still allows the value to be retrieved when it is posted back; don't think disabled fields get picked up.
You can validate the input text, if entered manually to the textbox.
Have a look at the url below,
http://keith-wood.name/uiDatepickerValidation.html
Hope this helps.
Cheers

input type text value not visible in safari ipad

I have an input type text in an iframe. When I try to add value through document.getElementById('someid').value , it does not show the value in the text box. Strangely if I query it using either jquery or document.getElementById('someid').value, it fetches me the value. Also, when I type the value through keypad, it shows the value in it but strangely I cannot set it through javascript. Why can't I see the value in the input type text field? Any thoughts? I am not able to get any support from the web yet. Please help
it could be that this CSS causes the issue:
* {
-webkit-user-select: none;
}
And avoid using focus();//jquery property
can you please try to remove it and give it a try?

Clearing jQueryMobile DateBox value from an event

I have 2 DateBox (from & to). What I want to do is whenever I click on the "from" DateBox it will always clear the "to" DateBox.
I'm looking at the doclear method and I'm not sure if it is the right one or even know how to use it.
Just to be clear I'm using this.
Any help would be appreciated. Thanks!
In my testing setting the value of the box to an empty string ('') works.
Assuming id of fromDate and toDateon the two boxes the following code should do the trick:
$('#fromDate').click(function(){
$('#toDate').val('');
}

Resources