Pregunta

I have this code in my page.

$(document).ready(function () {
            $("#ba_object_Code").change(function () { $("#HRBK").val($(this).val()); });
            $.cookie('cookie_name', 'cookie_value');
            if (sessid == 'xyz') {
                $("#ControlPlanID").removeAttr('disabled');
            }
            $(".t-grid-action.t-button.t-state-default.t-grid-add").click(function () {
                $.cookie('sessid', 'xyz');
            });

        });

I am getting this error

Microsoft JScript runtime error: Object doesn't support this property or method

¿Fue útil?

Solución

Your not defining sessid, so when you call it, it will fail.

See working example: http://jsfiddle.net/zNDHN/

$(document).ready(function () {

            var sessid = $.cookie('sessid');

            $("#ba_object_Code").change(function () { $("#HRBK").val($(this).val()); });
            $.cookie('cookie_name', 'cookie_value');
            if (sessid == 'xyz') {
                $("#ControlPlanID").removeAttr('disabled');
                console.log('cookie_found');
            }
            $(".t-grid-action.t-button.t-state-default.t-grid-add").click(function () {
                $.cookie('sessid', 'xyz');
                console.log('cookie_created');
            });

        });

Otros consejos

order is important and jquery files have to be included in_layout.cshtml incase master page is used... 'JQuery' is undefined

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top