Jump to content

On the Nature of the CSS display Property


Recommended Posts

BACKGROUND:  I have an AJAX call that pulls in an HTML file.  The file is a template that is populated with variables whose values are obtained from a MySQL database before the template is called.  One of the values that I obtain from the database is important to a script associated with the AJAX call.  This value should not appear, however, in the browser window when the AJAX call has been completed.  Now, I could easily hide the value of this variable with the CSS display property, but would it still be available to the aforementioned script?

QUESTION:  Is a hidden element still available for processing by other elements and script?


Link to comment
Share on other sites

Elements hidden by CSS are still in the DOM and can still be accessed by Javascript.

If there are values in the AJAX response that shouldn't be on the page, then don't put it on the page. You can store the result of an AJAX request in a variable instead of printing it.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...