javascript – Set Range Selection of All Text Between Two Elements

I have a javascript program that will copy a selection in a web page.

Is it possible to set that range selection through javascript?



I would like to set the range for everything between <h2> and <h4> so that I can copy the text to the clipboard.

unity – Box selection with Physics2D.BoxCastAll is mirrored when selecting in the bottom half of the screen

enter image description here

Using Physics2D.BoxCastAll based on rectangle is working fine when drawing is started on the top part of the screen, but when drawing is started on the bottom you can see this strange mirroring effect.


    void OnGUI()
    // LMB clicked
    if (Input.GetMouseButtonDown(0))
        boxStartPosition = new Vector2(
            Screen.height - Input.mousePosition.y

    // LMB drag
    if (Input.GetMouseButton(0))
        boxEndPosition = new Vector2(
            Screen.height - Input.mousePosition.y

        rectangle = new Rect(
            boxEndPosition.x - boxStartPosition.x,
            boxEndPosition.y - boxStartPosition.y

        GUI.DrawTexture(rectangle, RectangleTexture);

        float pixelsToWorld = Camera.main.orthographicSize / (Screen.height / 2f);

        Vector2 boxCenter = Camera.main.ScreenToWorldPoint(;

        boxCenter.y = Mathf.Abs(boxCenter.y);

        float boxWidth = Mathf.Abs(rectangle.size.x) * pixelsToWorld;
        float boxHeight = Mathf.Abs(rectangle.size.y) * pixelsToWorld;
        Vector2 boxSize = new Vector2(boxWidth, boxHeight);

        BoxCastDebug.DrawBoxCast2D(boxCenter, boxSize, 0f,, 0f,;
        hits = Physics2D.BoxCastAll(boxCenter, boxSize, 0f,, 0f);

Can anyone help me to solve these issues? Is it directly connected with setup of my scene, camera or scripts?

forms – Does displaying fields only after selection reduce conversion?

I’m designing a checkout flow, and it needs to ask the user for registration fields at 3 different times (this is necessary by the rule of the third party we are using). I know that this many fields is bad for the experience, so I thought of hiding the last field section at first, so that it is displayed only after the user selects the offer that will be available to him. The question is whether this is good practice or should I show the fields as soon as the screen loads.

lists – Color selection according to status

I’m designing a system where a list item can have one of 5 different status options:

  • LIVE

I want to specify a different color for every status.

For ACTIVE, PENDING and INACTIVE I decided on Green, Orange and Red.

What colors should I use for LIVE and LEGACY? You can also suggest different colors for the other statuses.

I added a tooltip on mouse hover that shows the status name.

Quick edit

After talking to our product manager, it’s now clear that there is no view where ACTIVE and LIVE are in the same screen, so both of them can be Green. All others can be in the same view.


download bmml source – Wireframes created with Balsamiq Mockups

drop down menu or search functionality when the number of options for selection is more than 60

My user/customer is a doctor and when registering must submit his/her specialty.The specialties are about 70.

Given that number(70) what do you think is better…a dropdown menu or an input that has a search functionality(makes an ajax call for every keyword typed)..or maybe sth else…I am open to suggestions.

settings – How to set which options appear on the text selection toolbar?

I’m referring to the menu that appears when you tap and hold on some text to select it. How do you change which options appear by default and which appear in the extra (. . .) menu?

I have to translate text regularly, and Google Translate used to appear on the text selection menu without tapping into the extra options. As of a week ago, Google Translate has been moved to the extra options menu, and a regular Google search is in its old place, so it’s an extra tap for me to translate text. I feel this is a system setting somewhere but cannot find anything about it.

Thanks in advance!

magento2 – How can I do product sorting on configurable’s child product attribute data depending on the layered navigation filter selection

I have a particular requirement where I need to do product sorting on configurable’s child product attribute data depending on the layered navigation filter selection.

The following illustration will help to understand the requirement in a better way.

  • Have a site that offers some courses, it is represented by a configurable product in M2.
  • Each course runs multiple times in a year, so they are child virtual products assigned to the configurable product.
  • Each course occurrence (child product) has a start date.
  • The “soonest” start date is held in an attribute against the parent course (latest date from children) and when we’re not filtering we can sort by this date and results are fine. For example, if we searched today you’d see courses starting next week at the top of the list.
  • When we add in a filter for a month like “September” the results returned will show the courses that have an occurrence happening in September – so this is fine. But the search by soonest is still looking at the earliest course start date.
    For example, course A had an occurrence on June 5th and one in September on September 20th, and course B had June 20th and September 5th.
    So the customer expects course B to show first because it starts sooner in September but the sort is still looking at that overall soonest date – parent not child.

So the problem is – how do we use the occurrence date of the child product when we’ve filtered. When I tried to set the child value into the layer collection item through customer code, it breaks the pagination.

Any help would be appreciated.

selection – To scroll or not to scroll

In a mobile app that I am currently developing one of the first things I do is secure a shortlist of the user’s interests. This kind of input is not unusual – I recall seeing something similar in sites & apps such as Pinterest. My own experience with being made to do this has been one of impatience at being shown multiple screens. At present I have opted to squeeze everything in my, rather limited superset of choices, to one screen:

as shown below.

My question – is there a commonly accepted view on what provides a better UX here. The options I guess are:

  1. Cram everything on to one screen (as I have done here)
  2. Require selection from a vertical scrolling list
  3. Use a paged display with the superset of choices broken up into more logical categories

One of my concerns with the latter two approaches is that the user cannot see their prior selections once they have scrolled/paged. OTH with the “cram everything” approach fat fingers are liable to cause annoyance.

Or perhaps there is another entirely different way to do things?

multi selection – should dual list orientation follow the language direction?

I got this question while working on a “Persian” app. As you may know, dual lists are consisted of 2 lists, where normally in a LTR language, the list on the left includes all the available options and the one on the right includes the ones that the user has selected from the left one. Now here’s my question: If the app’s language is a RTL one, should the order of the lists be reversed, meaning that the list with the available options be placed on the right, and the one with user’s selection on the left?

front end – How to select and delete all Output cells within current Selection only?

A similar question was already here: How to select and delete all Output cells?. But I have a more specific one: I want to delete all output cells within the currently selected cells only.

For this purpose I want to add an additional menu item Cell>Delete All Output within Selection.

Probably one would have to add something to


Has anybody already made such an improvement and could he please post it here?

(The version in this case is 12.1 and it probably has to reflect the version in question. This path is for a Linux machine. On a Windows machine the paths begin at a different root but parts from Wolfram to TextRessources probably will look the same, except for the forward slashes being replaced by backward ones- /X/ might be special for Linux).