How to set another key to behave like a tab button? [duplicate] - javascript

This question already has answers here:
How to advance to the next form input when the current input has a value?
(10 answers)
Closed 6 years ago.
I have a user interface created in HTML and working with Angular. I want to set one of the buttons from a numeric keyboard to behave like the Tab button. I want user to be able to switch fields in the interface using one of the buttons from a numeric keyboard.

Not possible - this article (http://www.howtocreate.co.uk/tutorials/javascript/domevents) explains (for security reasons) why your script can't simulate actual user interaction. You're going to have to simulate the "tab"s behavior instead (i.e focus in another field, etc.)

Related

How to use javascript to show the list of a datalist? [duplicate]

This question already has answers here:
Programmatically make datalist of input[type=url] appear with JavaScript
(2 answers)
Closed 2 years ago.
I have a datalist. Its list is empty at the beginning. I use javascript to append the options to that list and want to show the list immediately without clicking it manually. I may need to use javascript code to implement this. Could anyone know how to do this? Thanks in advance! By the way, document.getElementById("element").focus(); This doesn't work. It can only move the mouse to the input area but can't show the list. I want to show that list.
We need to create the "append the options to that list" function.
I think we can create that function based on the behavior of the click, and then run it after the page loads.

How to make an INPUT field dynamically change itself into a TEXTAREA in a Bootstrap4/jQuery webapp? [duplicate]

This question already has answers here:
jQuery change input type=text to textarea
(4 answers)
Closed 4 years ago.
How can I make an INPUT field dynamically change itself into a TEXTAREA in the browser, based on certain conditions (like the amount of text in it), without any extra logic server-side?
I have not tried anything yet, because I don't want to reinvent the wheel. I searched SO and found nothing. I'm looking for something like:
$('#myinputfield').automatically_morph_input_type_based_on_contents();
I doubt you'll find anything that is already prebuilt.
A simple thing you should consider is that, whether you really need an input or a textarea. And if you still think you need to switch between the too then you'll just have to dynamically create the two.
First remove the old element, create the new element, use the value, id, name and other attributes from the old element. Apply the same process for the next change.

How to make a suggestion list fully displayed on screen, only one can be selected? [duplicate]

This question already has answers here:
Pure CSS custom radio button (whole width) [closed]
(2 answers)
How to customize radio button in html
(4 answers)
CSS - Custom styling on radio button
(2 answers)
Use images instead of radio buttons
(10 answers)
Is it possible to customize with pure css radio button input without label?
(3 answers)
Closed 4 years ago.
I'm creating an application which at some point needs the user to choose between a maximum of 10 possibilities (could be less), what I need is something that is displaying all suggestions on the screen, without having to extend like regular dataList.
And I need to make sure only one of those can be selected at a time.
Something like this :
If I can make the selected one highlighted it could be even better.
If you know how to do it, I'd like your advice. No need to give me the full code of it if it bothers you, just the name of the different techs will be alright and the language associated.

prevent bots to click on clickable images in javascript [duplicate]

This question already has answers here:
Check if event is triggered by a human
(9 answers)
Closed 4 years ago.
I have some images that are clickable. for each click , users can get some point.
But I want to prevent clicks that do by bots. in fact I want a way to detect that a real user is clicked or a bot.
I want do that in javascript or jquery. if anyone know a plugin that can do that Please introduce me to it.
You can simply assume it’s human, provided access to the page is protected by reCAPTCHA, and subsequent requests carry a CSRF token.

Styling suggestions dropdown [duplicate]

This question already has answers here:
How to style the browser's autocomplete dropdown box?
(2 answers)
Closed 9 years ago.
Defaultly, when you input something to text field, you get suggestions with values you entered before. So my question is, is it possible to use CSS to modify appereance of that suggestion dropdown. Or could you please suggest javascript code to recreate its bahavior?
No, it is browser's native implementation. the browser doesn't even add or modify any new DOM element therefore you can not style the dropdown list. I am not 100% sure but it looks like the drop down list is on a different layer on top of the display page. You will need to have a your own Javascript implementation of autocomplete.
By the way to disable this browser behavior, add this to the input element:
autocomplete="off"
Note that not all browser support autocomplete attribute
You can't fiddle with the native browser's autocomplete box, but you can with custom implementations. I'd wager the most popular is this one: http://jqueryui.com/autocomplete/
I should note that the custom implementation won't serve up values the user has entered before unless you are capturing each term the user is entering, and use that list to populate your autocomplete box.

Categories