Pooja Batate
Pooja Batate

Reputation: 27

Replace cookie value to space character using jQuery

I have stored some textbox values in cookies.

But if textbox blank then cookie value will "null"

I am assigning that cookie value to another textbox.But due to the null value of cookie it showing me "null" in textbox.

I want to replace "null" with a blank space.

Upvotes: 2

Views: 309

Answers (3)

grc
grc

Reputation: 23555

It's hard to tell based on what you've said, but I think the problem might be that you are trying to access the textbox before it has loaded. Try something like this:

$(function() {
    // your code here
});

And as others have mentioned, it would be a lot easier to just do this:

$('input[name="Orders\\.Custom_Field_Custom1"]').val($.cookie('UploadFile',{ path:'/'}));

Upvotes: 1

Ariful Islam
Ariful Islam

Reputation: 7675

Try with

$('input[name="Custom_Field_Custom7"]').val('11111');

Upvotes: 1

Pranay Rana
Pranay Rana

Reputation: 176896

Make uf of .val() function will do you task.

$('#youtextboxid').val(valueneedtoset); 

Upvotes: 3

Related Questions