Code Ratchet
Code Ratchet

Reputation: 6029

Get the value of a disabled textbox with jquery

Is there anyway i can get the value of a textbox with jquery?

I have a table the rows are disabled when it reaches a certain status but i need to mouse over a certain field to display the content of that value in a pop up.

This is my code:

 $('.TariffName').mouseover(function (e) {
            x = e.pageX;
            y = e.pageY;
            var tr = $(this).closest('tr');
            var notes = tr.find('#txtTariffName').val();
            if (notes != "") {
                $("div#TariffWording").css('top', y).css('left', x);
                $("#TariffWording > p").text(notes);
                $('div#TariffWording').show()
            }
            else {
                $('div#TariffWording').hide()
            }

        });

Upvotes: 2

Views: 6712

Answers (2)

Vignesh Subramanian
Vignesh Subramanian

Reputation: 7289

try to use :disabled

$("input:disabled").val()

https://jsfiddle.net/vigneshvdm/7227gzpk/

Upvotes: 0

Ed DeGagne
Ed DeGagne

Reputation: 3269

Use the 'readonly' attribute instead of 'disabled' on text inputs.

Upvotes: 1

Related Questions