0

I have developed a pos system i have a product product1 barcode = 12345 and product2 barcode = 67890 i want that when a user scan 12345 it should be clicked

<div id="cat-filter-plus-{{ '12345' }}" data-barcode="{{ '12345' }}" class="clciked">
 <a href=""><img></a>
</div>
<div id="cat-filter-plus-{{ '67890' }}" data-barcode="{{ '67890' }}" class="clciked">
 <a href=""><img></a>
</div>

any idea or someone share his example which he is applied in his pos will be thank full

Hamza Qureshi
  • 172
  • 2
  • 20
  • 3
    pos scanners are usually treated as just keyboards as far as scanning and the hosting system is concerned. Write javascript to ensure a text input element has focus, monitor that input for the text that the scanner types, and take action accordingly. – Ouroborus Feb 02 '23 at 18:06
  • yes i understand this but i want some example – Hamza Qureshi Feb 02 '23 at 18:09
  • Example of what? How to listen for events on an input? How to locate a div based on an attribute? How to set a class? (or is that how to fire an event)? – freedomn-m Feb 02 '23 at 18:12
  • yes something like this – Hamza Qureshi Feb 02 '23 at 18:13
  • 1
    Off the top of my head, without any HTML provided, and with the data-barcode in a format that doesn't help yourself: `$(".pos").on("input", function() { $(\`[data-barcode="{{ '${$(this).val()}' }}"\`).addClass("clicked"); }` – freedomn-m Feb 02 '23 at 18:14
  • 2
    Google is for examples. Asking on Stackoverflow is for if you cannot resolve a specific issue after having done research and trying to solve it yourself. If you have tried to solve it yourself, edit your question to include your attempt and state what the specific issue is with your attempts that you've encountered. – Ouroborus Feb 02 '23 at 18:15
  • @Ouroborus there are lots of post like my post if u have no idea in ur mind you should not be here see this post he can also google it https://stackoverflow.com/q/507138/14913109 but he is also taking idea i am thankful to freedomn he is contributor – Hamza Qureshi Feb 02 '23 at 18:24
  • hi @freedomn-m you are adding class but it should not be add but it should be (#'cat-filter-plus-{{ '67890' }} div').click(); something like this thanks for your contributor – Hamza Qureshi Feb 02 '23 at 18:28
  • 1
    Which is why it's a throw-away comment. *"it should be clicked"* when you already have `class=clciked` [sic] - so makes sense that you want to change that class. – freedomn-m Feb 02 '23 at 18:40
  • 2
    To be clear: @Ouroborus *is* providing the *correct* response here - you'll see their comments have been upvoted. See [this meta post](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users) - and include your research / attempts in the question. – freedomn-m Feb 02 '23 at 18:43

0 Answers0