Search FieldID DOM

i'm trying to find the input fieldID to set focus() on view

Using the DOM but I don't know which fieldID to use to focus on the input field.


Ah great clearing the prior value is easy, just do this.

$(document).on('knack-scene-render.scene_157', function(event, scene) {
$('#view_306 input').focus().val("");

Thanks Tony - that works using the scene.

Now to try and get the previous search value to clear! :)

Thanks again for your help.

Use the Scene instead of the view like this

$(document).on('knack-scene-render.scene_157', function(event, scene) {
$('#view_306 input').focus();

When the page opens

When are you wanting it to focus on the search?

Thanks for you your input. But that didn't work.

It works when focusing on a form with a field name but not with the search input field.

My example code below.

$(document).on('knack-view-render.view_306', function (event, view, data) {
$('#view_306 input').focus();

Right-click on the input field then click inspect. Then look for field ID you will create the jquery string like this.


EDIT: Wait.. i see you are doing a search field one second for this search you can use.

$('#view_306 input').focus();