Richard,
You are a star! That's exactly what I needed - I couldn't get the
syntax of the script on the link quite right!
Perfect!
As a quick reference for anyone looking for something similar:
Header Script:
$('#dialog').dialog({ autoOpen: false });
Link Code:
onclick="$('#dialog').html('Enter a Date').dialog('option', 'title',
'Da Da').dialog('open');"
Page HTML (which I put in the footer of each page hidden with CSS):
<div id="dialog" title="Basic dialog"><p>default dialog </p></div>
Thanks to everyone for their input.
All the best
Bob
On Aug 12, 10:03 am, "Richard D. Worth" <[email protected]> wrote:
> You can reuse the one dialog for all these links.
>
> Step 1: Create one dialog init with autoOpen: false in your document.ready:
> $(function() {
> $('#dialog').dialog({ autoOpen: false });
>
> });
>
> Step 2: Change any current calls you have to init #dialog as a dialog to
> instead
> 2a. replace the html contents of the dialog
> 2b. update the title
> 2c. open the dialog
>
> $('#dialog').html(newHtml).dialog('option', 'title', 'New
> Title').dialog('open');
>
> - Richard
>
> On Wed, Aug 12, 2009 at 9:55 AM, Mr Fett <[email protected]> wrote:
>
> > Hi all,
>
> > Apologies for the lack of detail - I'm a total newbie when it comes to
> > jQuery.
>
> > YUDHI: Thanks again. The key factor here is that I need the dialog
> > box to be as reusable as possible, Yudhi - your sent example, while
> > much appreciated - would need me to create an entry like this:
>
> > $("#clk_opendialog").click(function() {
> > $("#dialog").dialog(dialogOptions);
> > });
>
> > ..for every single dialog box on the page.
>
> > What I'm trying to achieve is links that are "self contained", so lets
> > say I have a form on a page, I could have a little "help" link next to
> > each input that displays a brief explanation of what its about, I've
> > manage to do this by using links like this:
>
> > <a href="#" onclick="$('#dialog').html('This form item is for a
> > description of your hairstyle'); $('#dialog').dialog({ title:
> > 'Hairstyle Box' });">help</a>
>
> > This means I don't have to have a .click entry for every single link
> > in the header. In fact at present I don't have any code for the
> > dialog box in header - just that on the links and then this HTML in
> > every page ready to go: <div id="dialog" title="Basic dialog"
> > class="hideThis"><p>default dialog </p></div> (set to display: none in
> > css).
>
> > Clicking the link makes it display but it doesn't show on the second
> > try.
>
> > RICHARD: Thanks for this - I followed the link and looked at the info
> > but I have the same problem - it uses a pre-defined .click event and
> > I'm unsure how to create an entry in the header for what I have to
> > mirror what is there.
>
> > JEN: thanks for the tip, ideally I don't want to have to use a whole
> > new plugin if I can do this with the jQuery UI (as its already
> > included in the project) and is specfically design for this.
>
> > If anyone can just help me with what I imagine is a small addition to
> > the header of my page it would be much appreciated!
>
> > Thanks again for all the help so far
>
> > Bob
>
> > On Aug 11, 11:23 pm, computeraholic® <[email protected]> wrote:
> > > Complete code please,..
> > > I can not analyze if the code you provided is not complete.
>
> > > Salam,
>
> > > YUDHI ARMYNDHARIS
> > > blogger:http://tutorial-jquery.blogspot.com
> > > visit my website :http://www.jayakreasi.com
>
> > > On Wed, Aug 12, 2009 at 8:51 AM, Mr Fett <[email protected]>
> > wrote:
>
> > > > Hi all,
>
> > > > I'm trying to find a simple way to use the jQuery UI Dialog box to
> > > > provide simple context sensitive help.
>
> > > > Thus far I have a bit of HTML at the bottom of every page that is
> > > > hidden:
>
> > > > Then I invoke the Dialog box from a self contained link like this:
>
> > > > <a href="#" onclick="$('#dialog').html('Enter a Date'); $
> > > > ('#dialog').dialog({ title: 'Da Da' });">help</a>
>
> > > > Unfortunately, after the first dialog box is closed, the rest cease to
> > > > work - presumably because the HTML in the footer is being removed, not
> > > > just hidden.
>
> > > > Does anyone have any suggestions or a more elegant solution? I feel
> > > > like I'm missing something really obvious as surely this is exactly
> > > > the sort of thing 'dialog' should be used for.
>
> > > > Thanks
>
> > > > B
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---