ian_st
asked on
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.
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.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
var optHid = $(YourField).find ('input').attr('optHid');
var ID = $(hid).attr('value');
ID will contain selected item value.