Enabled country selection in readonly input
See original GitHub issueI think it will be useful if it will be some option to enable readonly mode for input while country dropdown continue working. Why I need this ? In my case I use 2 inputs with intlTelInput . First only for country code (that must be change only trough dropdown ) and use this settings
nationalMode: false,
autoHideDialCode: false,
and second for mobile number
nationalMode: true,
autoHideDialCode: false,
So to make first input disabled for editing we need to remove
!that.telInput.prop("readonly")
from this lines
selectedFlag.on("click" + this.ns, function(e) {
// only intercept this event if we're opening the dropdown
// else let it bubble up to the top ("click-off-to-close" listener)
// we cannot just stopPropagation as it may be needed to close another instance
if (that.countryList.hasClass("hide") && !that.telInput.prop("disabled") && !that.telInput.prop("readonly")) {
that._showDropdown();
}
});
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
HTML form readonly SELECT tag/input - Stack Overflow
If you reenable your SELECT, you should copy its value to the hidden input in an onchange event and disable (or remove) the...
Read more >HTML attribute: readonly - HTML: HyperText Markup Language
The Boolean readonly attribute, when present, makes the element not mutable, meaning the user can not edit the control.
Read more >HTML input readonly Attribute - W3Schools
The readonly attribute can be set to keep a user from changing the value until some other conditions have been met (like selecting...
Read more >Allow selecting and copying text from inputs with Enabled=false
The reason we need a ReadOnly state is because the user can not highlight to select the text to copy/paste if desired... that...
Read more >Forms in HTML documents - W3C
submit buttons: When activated, a submit button submits a form. ... The INPUT element is used to create a file select control. hidden...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
+1. Would be very useful to use this control as a country + country code dropdown only.
Well then yes issue 317 will solve your problem because it will display the selected country code, and the user wont be able to edit it, and you’ll be able to use
getSelectedCountryData
to get the value. You can just hide the input as you wont need it.