Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19923

Re: How can this work as it does

From tony@mountifield.org (Tony Mountifield)
Newsgroups comp.lang.javascript
Subject Re: How can this work as it does
Date 2013-05-24 14:25 +0000
Organization Software Insight Ltd., Winchester, UK
Message-ID <knnt86$ujj$1@softins.clara.co.uk> (permalink)
References <knn912$659$1@dont-email.me>

Show all headers | View raw


In article <knn912$659$1@dont-email.me>,
Tony <tony.johansson@inport.com> wrote:
> This code works as it should but there is one thing that
> I don't fully understand.
> 
> In the html markup at the end I have this div
>   <div id="dlgInsertLots" title="Insert Lots" style="width:500px; 
> display:none">
> ...
> which is not displayed because we have said display:none
> 
> Now to my question when I click on button with id= InsertLots this function 
> Click_InsertLots is called.
> function Click_InsertLots()
>   {
>       //Create and display dialog dlgInsertLots
>       $("#dlgInsertLots").dialog({
>           width:700
>       });
>   }
> 
> but this div with id=dlgInsertLots is displayed which is the behaviour that 
> I want.
> What I want to know is why is it displayed now but not when the html page 
> was displayed the first time.
> I don't want to change anything because it works perfect but I don't 
> understand how it can work as it does.

When you use an inline style, that style is treated as a single entity.
So it would appear you are replacing the style "width:500px; display:none"
with the style "width:700". That overwrites the complete inline style, and
the replacement style doesn't include "display:none".

Cheers
Tony
-- 
Tony Mountifield
Work: tony@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How can this work as it does "Tony" <tony.johansson@inport.com> - 2013-05-24 10:44 +0200
  Re: How can this work as it does "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-05-24 11:09 +0200
    Re: How can this work as it does Tim Streater <timstreater@greenbee.net> - 2013-05-24 12:55 +0100
      Re: How can this work as it does JJ <duh@nah.meh> - 2013-05-25 04:33 +0700
        Re: How can this work as it does Tim Streater <timstreater@greenbee.net> - 2013-05-24 22:50 +0100
    Re: How can this work as it does Christoph Becker <cmbecker69@gmx.de> - 2013-05-24 14:29 +0200
      Re: How can this work as it does Denis McMahon <denismfmcmahon@gmail.com> - 2013-05-24 22:13 +0000
        Re: How can this work as it does Christoph Becker <cmbecker69@gmx.de> - 2013-05-25 00:56 +0200
  Re: How can this work as it does tony@mountifield.org (Tony Mountifield) - 2013-05-24 14:25 +0000
    Re: How can this work as it does Christoph Becker <cmbecker69@gmx.de> - 2013-05-24 17:21 +0200
  Re: How can this work as it does JJ <duh@nah.meh> - 2013-05-25 04:30 +0700

csiph-web