Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28927

Re: trying to disable a text input field when a particular select list option is selected in a select field but this code has no effect

From Stefan Weiss <krewecherl@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: trying to disable a text input field when a particular select list option is selected in a select field but this code has no effect
Date 2015-11-30 09:43 +0100
Organization albasani.net
Message-ID <n3h27k$52k$1@news.albasani.net> (permalink)
References <72249e91-27c8-4895-ae4d-f4d974e1b85d@googlegroups.com>

Show all headers | View raw


On 2015-11-30 05:23, fugee279@gmail.com wrote:
> <script>
> $(document).ready(function () {
>   $('#select_field').change(function(e) 
>    {
>     if (e.target.value=='select_value') {e.second_field.disabled = true;}
>   })
> })
> </script>

Next time, please include the error message you see in the console.

The parameter `e` is the Event object for the change event. This object
doesn't have a "second_field" property. Not knowing what your document
looks like, I can only guess at a solution... possibly

    $("#second_field").prop("disabled", true);


- stefan

Back to comp.lang.javascript | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

trying to disable a text input field when a particular select list option is selected in a select field but this code has no effect fugee279@gmail.com - 2015-11-29 20:23 -0800
  Re: trying to disable a text input field when a particular select list option is selected in a select field but this code has no effect Stefan Weiss <krewecherl@gmail.com> - 2015-11-30 09:43 +0100
    Re: trying to disable a text input field when a particular select list option is selected in a select field but this code has no effect fugee279@gmail.com - 2015-11-30 04:11 -0800
      Re: trying to disable a text input field when a particular select list option is selected in a select field but this code has no effect Stefan Weiss <krewecherl@gmail.com> - 2015-11-30 14:24 +0100
        Re: trying to disable a text input field when a particular select list option is selected in a select field but this code has no effect fugee279@gmail.com - 2015-11-30 11:06 -0800
        Re: trying to disable a text input field when a particular select list option is selected in a select field but this code has no effect Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-11-30 22:25 +0100
    Re: trying to disable a text input field when a particular select list option is selected in a select field but this code has no effect Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-11-30 22:43 +0100

csiph-web