/    Sign up×
Community /Pin to ProfileBookmark

filter a drowndown <selection> based on the value of a div

First I want to thank in advance anyone who takes the time to read this post. I am having a mental block. I need to filter a drop down <selection> based on the numeric value in a div. So if the value is positive I only show items with the word credit, if the value is negative I only show items with the word debit. Thanks again for the help.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@freginoldMar 28.2016 — If just using vanilla JS, you could use document.getElementById('divID').value to get the div's value, compare it to 0 to see if it's positive or negative, and use .match() to return instances of either 'credit' or 'debit' in the list/string.
Copy linkTweet thisAlerts:
@xelawhoMar 30.2016 — It may make more sense to set the select options at the time you are setting the value of the div. Do you have control over that?
×

Success!

Help @redmisfitx 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...