Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Identify Input ID

Featured Replies

I have a form where there is an input box with an ID. However, the ID is altered each time the form is run.

The format is q?:1_answer where ? is an incremental value (for example, 11739, then 11740).

I want to submit an automated response to the input box but cannot change it's behaviour. So, I need a line of Javascript that will identify the current ID for that instance of the input box on that particular moment in time.

Anyone any ideas?

You can target the input by something other than an ID, e.g. a class or data-* attribute that will likely not be dynamic. 

$id = $('#myform input').map(function() {
  return this.id;
}).get();

This, I hope, should return the ID of any input element in your Form, if you have multiples it will return an array of IDs - but I think you just have one that dynamically updates, right?

I'm at work, so I cannot actually test this. I hope it works for you. If you have multiple input elements, you will need to target the element based upon something like class, as Lyndsey suggested.

 

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.