/    Sign up×
Community /Pin to ProfileBookmark

access visible value in option instead of .value

Hey everyone, I got a little problem. I’m making an asp website, something with organisations and uploading pictures. For the admin-part, I have a select-list with in the visible part the name of the picture (like DC0001.jpg) and the values are the id’s of the corresponding pics in the database.

Next to the list I want a preview of the pic. No problem, I have found a script for that, with the onChange method, without the page reloading. The only problem is, that in order to use that script, the value of the list item must be the picture’s name.

And that’s the problem, I need the value to be the ID of the pic (just a number), for my asp code. So I was wondering if it is possible to retrieve the value which is visible from the list, in javascript?

Any help would be greatly appreciated, thanks in advance.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@FangMay 21.2005 — document.forms['formName'].selectName.options[Index].text;
×

Success!

Help @cee spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...