Loading...
Copy code
Close
Permalink
Close
Please tell us why you want to mark the subject as inappropriate.
(Maximum 200 characters)
Report Inappropriate
Cancel
Private Message
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Cancel
From :
guest
To :
Subject :
Content :
Type the characters you see in the picture below.
Send
Update
Cancel
Feedback
Email ID
Subject :
Comments :
Send
Cancel
Private Message
Type the characters you see in the picture below.
Type the characters you see in the picture below.
Attach files
Desktop
Google Docs
Each Attachment size should not exceed 1.0 MB.
Max no of attachments : 3
Loading User Profile...
guest
Response title
This is preview!
Attachments
Publish
Back to edit
Cancel
(
)
Sign In
New to this Portal? Click here to
Sign up
You can also use the below options to login
Login with Facebook
Login with Google
Login with Yahoo
jQuery
Plugins
UI
Meetups
Forum
Blog
About
Donate
All Forums
Recent Posts
Log In
Search
jQuery
Search
jQuery Forum
Move this topic
Forum :
Getting Started
Using jQuery
Using jQuery Plugins
Using jQuery UI
Developing jQuery Core
Developing jQuery Plugins
Developing jQuery UI
QUnit and Testing
About the jQuery Forum
jQuery Conferences
jQuery Mobile
Developing jQuery Mobile
Sub forum :
Move this topic
Cancel
Getting Started
warozzo
Select an option when input change
in
Getting Started
•
5 years ago
I want to select an option when I insert a value into an input. Here's my HTML:
<input type="text" id="point" />
<select id="passed">
<option value="2"> -- Choose --</option>
</select>
And here is the JS:
$(document).ready(function () {
$("#point").change(function () {
var val = $(this).val();
if (val === 0 && val < 60) {
$("#passed").html("<option value='0' selected='selected'>Not passed</option>");
} else if (val >= 60 && val === 100) {
$("#passed").html("<option value='1' selected='selected'>Passed</option>");
}
});
});
Please help me to achieve this.
1
Replies(2)
jakecigar
Re: Select an option when input change
5 years ago
$(document).ready(function () {
$("#point").change(function () {
var val = +$(this).val();
// the + makes it a number.
if (val > 0 && val < 60) {
// it can't be === 0 and < 60
$("#passed").html("<option value='0' selected='selected'>Not passed</option>");
} else if (val >= 60 && val <= 100) {
// same
$("#passed").html("<option value='1' selected='selected'>Passed</option>");
}
});
});
https://jsfiddle.net/jakecigar/0bs8655d/
<--
JΛ̊KE
Leave a comment on jakecigar's reply
coldfusio..
Re: Select an option when input change
5 years ago
Hello,
Not exactly sure what you are doing but for this:
if (val === 0 && val < 60) { //Only true when val EQUALS zero
then you have;
else if (val >= 60 && val === 100) {//
Only true when val EQUALS 100
Can you create a JS Fiddle of your code?
Jim
Leave a comment on coldfusionguy's reply
Change topic type
Topic Type :
Discussions
Questions
Ideas
Problems
No of days :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Change topic type
Cancel
Link this topic
Provide the permalink of a topic that is related to this topic
Permalink
Save
Close
Reply to warozzo's question
Top
Reply
{"z18738316":[14737000007522304],"z3499963":[14737000007525152],"z2950240":[14737000007522300]}
Statistics
2
Replies
1537
Views
2
Followers
Tags
Cancel
input
option
Actions
Permalink
Related Posts
:input doesn't match option
Display other input when option is...
hide show input field based on sele...
Check option and change input value...
Remove option from select input