2

I have a radio button something like this,

<input type="radio" value="A" name="NodeLevel" />

When not disabled I could get the value of a pretty easily

using, $("input[name=NodeLevel]").click(function () {},

but when the input type is disabled, how can I get the value of a radio button ?

any work arounds ?

SRA
  • 1,681
  • 7
  • 27
  • 49

3 Answers3

2

As per HTML specification, a form element must be "successful" in order to be sent to the server. Disabled elements are not considered successful (as per the same spec). You can make the element readonly or send it as a hidden form element.

this thread here might shed some light to ur problem

How can I get the form value from a disabled <input> element

Community
  • 1
  • 1
manraj82
  • 5,929
  • 24
  • 56
  • 83
0

Have you tried .val()?

$("input[name=NodeLevel]").val()
// returns 'A'

And you can't bind a click event to a disabled element.

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
0

I think when your form field is disabled you can not access its value. Use some hidden field to contain the same value and read from there.

Ankit Jaiswal
  • 22,859
  • 5
  • 41
  • 64
  • another option is to make the field readonly instead of disabling it, that way you can read the value but it would be a readonly field. – Ankit Jaiswal Aug 09 '10 at 12:12