This project has moved and is read-only. For the latest updates, please go here.

Set value to hidden column by jquery

Dec 31, 2011 at 10:05 AM

Hi All

Have one question here. I am trying to set value to a hidden column

previously i have achieved by doing

var bc = $("select[title='Broadcast Channel']").val();
$("select[title='Execution Channel']").val(bc);

this is no problem as I am able to get the column which exist in html source.

Now i am trying to set value to a hidden column which i have hide in sharepoint 2010 list setting.

and i not able to find it under html source (eg. <input type=hidden....>)

so how can i set value to this  hidden column?

 any help is much appreciate. Thanks!

Dec 31, 2011 at 1:24 PM
Can you post the full HTML of the hidden input field?
I assume that it does not have a 'title' attribute, so you will have to use a different selector... Something like $("input[type='hidden']")... But because there will be other hidden elements in the page, you need more specific criteria.


Sent from mobile device.

Dec 31, 2011 at 2:22 PM


Hi Paul

As mentioned, in HTML source, it doesnt hv hidden input field like <type=hidden>

because I hidden it by using sharepoint list setting.

So end up, i decide to enable the field again, use jquery to hidden it, and call by using $('input[title...]) again.

And it works. :)

but it u dun mind, can i ask another thing about jquery.

sorry i am quite new to jquery and i just google and try to use without fully understand.

Is $("[id='sthID']").val()

equals to $("#sthID").val()

and one thing does $(' same with $(" ?  (single quote or double quote matter?) 

I am sorry to ask u this question over here...or mind to share if you have any good resources about this?

Thanks very very much and Happy New Year to u :)

Dec 31, 2011 at 3:27 PM

Glad to hear you resolved your issue. Sounds like the field you wanted to set was not present in the html. I miss understood you in thinking that it was, but was defined as a HTML hidden input.

Regarding your questions on jquery:

1) Is $("[id='sthID']").val() equals to $("#sthID").val()

Yes, they are the same. The second method (using the #) is preferred because it is faster at finding the element.... however, in same cases, specially those where the ID has special characters, which SP does use in IDs, you will have to use the first method.

2) use of quotes
It does not matter which one you use.


Sent from mobile