Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9009827
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:18:05+00:00 2026-06-16T02:18:05+00:00

I have several popups with multiple input fields. I want to highlight the FIRSTinput

  • 0

I have several popups with multiple input fields. I want to highlight the FIRSTinput element of all my popups, and I DO NOT want to use ids:

my code:

function initPopups(){
    $('*[id*=Popup]').each(function() {
        $(this).on({
                    // disables the auto close on outer clicks
            popupbeforeposition: function () {
                // removes all handlers from the 'background'(-layer.class) of the popup
                $('.ui-popup-screen').off();
            },
                    // SHOULD highlight the first textfield after popup opened
            popupafteropen:function(){
                console.log("OPENED");
                   $('form:first *:input[type!=hidden]:first').focus();
            }
        });
    });

Here is the html of one popup:

<div data-role="popup" id="create_stationPopup" class="ui-content">
            <a href="#" data-rel="back" data-role="button" data-theme="c" data-icon="delete" data-iconpos="notext"
               class="ui-btn-right">Close</a>
            <form>
            <input type="text" name="name" id="station_input_title" value="" data-mini="true" placeholder="Titel der Station" />
            <input type="text" name="name" id="station_input_number" value="" data-mini="true" placeholder="Nummer der Station"/>
            <textarea name="textarea" id="station_input_text" placeholder="Beschreibe diese Station"></textarea>
           </form>
            <a href="#create_stationQuestionPopup"  data-rel="popup" data-role="button" data-theme="c" id="createWave_questionBtn" >Frage
                hinzufügen</a>
            <a id="createWave_stationSaveBtn" data-role="button" data-theme="c">Station
                speichern</a>
        </div>

My code only highlights THE FIRST input field in my HTML file, not the first input field in all popups (which are in static html)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:18:06+00:00Added an answer on June 16, 2026 at 2:18 am

    with the help of @Trufa I fixed it the following way:

    function initPopups(){
        $('*[id*=Popup]').each(function() {
            $(this).on({
                popupbeforeposition: function () {
                    // removes all handlers from the 'background'(-layer.class) of the popup
                    $('.ui-popup-screen').off();
    
                },
                popupafteropen:function(){
                       $('.ui-popup-active *:input[type!=hidden]:first').focus();
                  }
            });
        });
    }
    

    Every popup gets the class .ui-popup-active when it is on screen, so simply use that and highlight the first input field 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several xml files with different node structure. I want to extract xml
I have a custom activity which has inargument<MyClass>. MyClass has several properties. I want
I have Several UIImageViews in a NSMutableArray. They are all in the superView. I
We use MOSS 2007, and I have a document library with several document templates
I have the following HTML code (which is placed within several files), which inserts
I'm creating one facebook application with FBML. What I want is: I have several
I have an application which lets the user open several draggable popups. I don't
I have a several links on the page and I want to show individual
I have been tasked with testing the contents of several pop-ups throughout our application.
I have a modal popup with several links inside that have the :confirm and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.