Insert class to an invisible element

Asked

Viewed 53 times

0

How do I insert a class via jQuery to an element that is not visible on the page?

  • 6

    In the same way that you add the class to a visible element :) It does not need to be visible to be manipulated, just exist in the document. If it doesn’t exist, there’s no way.

  • 3

    https://api.jquery.com/addclass/

  • To ask a good question read [Ask] and How to create a Minimum, Complete and Verifiable example

  • I need to insert classes in rows of a table that make up the return of an autocomplete, that is, the table does not exist, when I type a term in the text field the table is created with the suggestions.

  • 1

    And do you receive this table in what format? HTML? does it come via ajax of the autocomplete? comes from your server? can you detail more?

  • the information comes from a json

  • Do you mount the table in javascript with JSON? or is it the autocomplete that mounts the table?

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.