Jump to content
Sign in to follow this  
iwato

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?

Roddy

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...