How to get selected value (id) from lookup field using javascript (jQuery)

Hi,
I need to get lookup fields selected item value ( i mean not a text value, but lookup item ID ) on my new/edit item form by using jscript ( jQuery ) from lookup field with more than 20 items and also from multi-value lookup.

I can find, change options, get text value, but not an ID of selected item. Well it coud be possible to find ID by listing all options in lookup, but what if i got 2 or more items with same title?

Thanks.
ian_stAsked:
Who is Participating?
 
EE_AutoDeleterCommented:
Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.

EE_AutoDeleter
0
 
ian_stAuthor Commented:
Solved for lookup with more than 20 items.
var optHid = $(YourField).find ('input').attr('optHid');
var ID = $(hid).attr('value');

ID will contain selected item value.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.