Remove attached image from jQuery dialog title


Jane S

I've looked into various solutions on StackOverflow but haven't had any success getting them to work. I can easily add an image to the dialog, but various attempts to remove the image have failed, so I get multiple images.

Note that I don't want it to appear in "all" dialogs, but just in a series of welcome dialogs. Here is the code (one of them) so far:

 $("#welcomeScreen").dialog({
            width: 600,
            height: 400,
            position: "center",
            dialogClass: 'help-dialog',
            hide: {
                effect: "fade",
                duration: 200,
            },
            open: function (event, ui) {
                $("#myNewImage").remove();
                $(".ui-dialog-titlebar").append("<img src='Images/question.png' id='myNewImage' />");
            }
        }).parents(".ui-dialog").css("opacity", "0.9");

dialogClass changes the background color of these dialogs.

I also tried:

$(".ui-dialog-titlebar").remove('#myNewImage');

No effect, subsequent openings will have another icon attached to the title bar. I also tried

$(".ui-dialog-titlebar").remove();

Removed the entire title bar (I was kind of looking forward to it).

So really, I just want the icon to show up in the title bar, show a few dialogs, and not show up on any other dialogs. What am I doing wrong? :)

Mr.TK

I think your code does work :)

Check the jsfiddle of my code:

http://jsfiddle.net/FYhNw/1/

Button add added IMG - remove to remove it!

$(".ui-dialog-titlebar").append("<img src='Images/question.png' id='myNewImage' />");   

$("#myNewImage").remove();

That's your code :) - so remove will do what it's supposed to! :)

If you want this img to be displayed only in a few dialogs, do an IF statement.

Related


Remove attached image from jQuery dialog title

Jane S I've looked into various solutions on StackOverflow but haven't had any success getting them to work. I can easily add an image to the dialog, but various attempts to remove the image have failed, so I get multiple images. Note that I don't want it to a

Remove title from dialog in Android

Sijo Jos How to remove the title of a custom dialog. and delete its space at the same time. Thank you. my layout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content

Remove title from dialog in Android

Sijo Jos How to remove the title of a custom dialog. and delete its space at the same time. Thank you. my layout <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content

Remove HTML tags from image title and Alt attribute using jQuery

Jason I have a client using a CMS and the title and alt image attributes have been pulled from the title. Most headers have html (span and br tags) in them. Do I need to remove the html tags from the title and alt text in the following sample code? <ul class="

Remove HTML tags from image title and Alt attribute using jQuery

Jason I have a client using a CMS and the title and alt image attributes have been pulled from the title. Most headers have html (span and br tags) in them. Do I need to remove the html tags from the title and alt text in the following sample code? <ul class="

Remove HTML tags from image title and Alt attribute using jQuery

Jason I have a client using a CMS and the title and alt image attributes have been pulled from the title. Most headers have html (span and br tags) in them. Do I need to remove the html tags from the title and alt text in the following sample code? <ul class="

How to remove title from custom dialog?

Ganesh I am trying to implement a custom dialog. I created separate xml for custom view of dialog. Here I hate the big black title bar (title bar) that exists in that dialog. I need to remove that title bar and I want it to be exactly as it is in my xml file.

How to remove title from custom dialog?

dream I implemented a layout to be my custom dialog layout like this: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/gray_back" xmlns:androi

How to remove title from custom dialog?

dream I implemented a layout to be my custom dialog layout like this: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/gray_back" xmlns:androi

How to remove title from custom dialog?

Ganesh I am trying to implement a custom dialog. I created separate xml for custom view of dialog. Here I hate the big black title bar (title bar) that exists in that dialog. I need to remove that title bar and I want it to be exactly as it is in my xml file.

How to remove title from custom dialog?

Ganesh I am trying to implement a custom dialog. I created separate xml for custom view of dialog. Here I hate the big black title bar (title bar) that exists in that dialog. I need to remove that title bar and I want it to be exactly as it is in my xml file.

How to remove title from custom dialog?

Dream I implemented a layout to be my custom dialog layout like this: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@color/gray_back" xmlns:androi

How to remove title from custom dialog?

Ganesh I am trying to implement a custom dialog. I created separate xml for custom view of dialog. Here I hate the big black title bar (title bar) that exists in that dialog. I need to remove that title bar and I want it to be exactly as it is in my xml file.

Change jQuery dialog title from child element

User 819774 I've tried a few things from around the web about changing the title of a jQuery dialog, but I've had no success. Can someone help me how to do this. Thanks in advance I have many existing popup pages that are opened using the window.showModalDialo

Change jQuery dialog title from child element

User 819774 I've tried a few things from around the web about changing the title of a jQuery dialog, but I've had no success. Can someone help me how to do this. Thanks in advance I have many existing popup pages that are opened using the window.showModalDialo

Remove attached element on dialog closes

Anibel I use JQuery and Ajax to update the database. After each successful update, the png icon is displayed for 1 second. More specifically, the update form is contained within a JQuery dialog. The problem is that after updating and closing the dialog, the ic

Remove attached element on dialog closes

Anibel I use JQuery and Ajax to update the database. After each successful update, the png icon is displayed for 1 second. More specifically, the update form is contained within a JQuery dialog. The problem is that after updating and closing the dialog, the ic

jQuery: remove attached element

year I have the following code: $.each(pk2, function(i,value) { $('#query_form_opt_'+cell+'_2') .append($("<option></option>") .attr("value", i+1) .text(value)); }); My problem is that this code is called timeout and new

jQuery: remove attached element

year I have the following code: $.each(pk2, function(i,value) { $('#query_form_opt_'+cell+'_2') .append($("<option></option>") .attr("value", i+1) .text(value)); }); My problem is that this code is called timeout and new

Remove background image from title page latex

Aiden I put a background image on all slides. However, I want to remove that image from the only front page and keep the background of the rest of the slides. The following code is how I put this image in all slides. \usebackgroundtemplate{% \tikz[overlay,reme

Remove background image from title page latex

Aiden I put a background image on all slides. However, I want to remove that image from the only front page and keep the background of the rest of the slides. The following code is how I put this image in all slides. \usebackgroundtemplate{% \tikz[overlay,reme

Remove background image from title page latex

Aiden I put a background image on all slides. However, I want to remove that image from the only front page and keep the background of the rest of the slides. The following code is how I put this image in all slides. \usebackgroundtemplate{% \tikz[overlay,reme

Remove background image from title page latex

Aiden I put a background image on all slides. However, I want to remove that image from the only front page and keep the background of the rest of the slides. The following code is how I put this image in all slides. \usebackgroundtemplate{% \tikz[overlay,reme

Remove background image from title page latex

Aiden I put a background image on all slides. However, I want to remove that image from the only front page and keep the background of the rest of the slides. The following code is how I put this image in all slides. \usebackgroundtemplate{% \tikz[overlay,reme

How to add and remove tables from jQuery dialog

bzc0fq I want to add and later delete the table with all the rows from the jquery dialog. I also want to add some CSS styles to that table/row. The table should be put into an empty div id=dialog-message1. Can someone help me? The function script part is attac

How to add and remove tables from jQuery dialog

bzc0fq I want to add and later delete the table with all the rows from the jquery dialog. I also want to add some CSS styles to that table/row. The table should be put into an empty div id=dialog-message1. Can someone help me? The function script part is attac

JavaFX dialog remove title decoration

Cheese Wessos Is there a quick way to remove the Dialog header in JavaFX? Or should I go and create my own dialog? TextInputDialog dialog = new TextInputDialog(); dialog.setTitle("create DATABASE"); dialog.setHeaderText("create DATABASE"); dialog.setContentTex