load an image into struts2 tooltip - struts2

I am trying to show an image in a tooltip, but all i get is the plain text. Code :<s:textfield label="cvv" name="cvv" tooltip="<img src='%{images}/cvv_34.gif'>" />
When I hover on my tooltip image all I see is the text <img src='xyz.com/cvv_34.gif'>
I have tried jsTooltipEnabled and it doesn't help. I am able to open the image in a separate browser, so image path's, etc are all good.
Any help would be appretiated.

That is because the input is escaped and I think it is not good practice to reference an image there. If you like fancy Tooltips take a look at the jQuery and css frameworks you are maybe using.
jQuery Ui Tooltip
Bootstrap Tooltip

This is not depends on struts, but I recommend qTip2.
http://qtip2.com/
With this you can show almost everything in a tooltip. Simple text, or a complete html enabled content. Also you can make this tooltip ajax enable too.

Related

How do I apply styling to polymer elements?

I've been trying to read the documentation, but I don't get it. There doesn't seem to be any stackoverflow questions too. Right now using Polymer v1.0 with MVC 5.
For example, let's take the paper-toolbar. I have this sample code:
<paper-toolbar>
<paper-icon-button icon="menu"></paper-icon-button>
<span class="title">My Title</span>
<paper-icon-button icon="refresh"></paper-icon-button>
<paper-icon-button icon="add">+</paper-icon-button>
</paper-toolbar>
How do I apply a white background to it?
In the polymer website:
I've seen that there are custom properties and mixins... but how do I use them?
For example, how would I override the "--paper-toolbar-background"? to make the background white?
Thanks!
The approach I recommend is having an element for styling purposes, for example an app-theme.html. Put it inside your elements directory and import it.
If your app-theme.html looks like the following, it should style your paper-toolbar properly:
<style is="custom-style">
paper-toolbar {
--paper-toolbar-background: var(--paper-blue-900);
}
</style>
I use this approach for the Paper elements. For custom elements I put the styling inside each element.
Though theoretically you could just take my above code and paste it just before you use the element, but this approach has the issue that the default styling is applied before, resulting in breaks.
Of course you could also just use a normal app.css file to style the paper elements, but then you would have to use the !important attribute to overwrite the default styling of the element. Don't recommend it though.
Hope it helps.
George

jQuery mobile 1.2: Override opacity of .ui-disabled

i am trying to override the opacity of ui-disabled in my app to have a not focusable textfield with white text that i can change per js (<disabled="true">).
i don't know if it will work on all browsers with the opacity set to 1
or how to use the suggestion on this page exactly (on mobileinit or as a css-file and how about the semantics):
http://jquerymobile.com/demos/1.2.0/docs/api/themes.html
You can override jQuery Mobile's CSS with your own. Include a stylesheet after jqm's in your html, or use a style=... attribute on your html tag — either will override the default. Hence the Cascading in Cascading Style Sheets.
I highly recommend using the developer tools built into most browsers. In Chrome, for example, right-click anything in a web page and select Inspect Element. It will show you the computed CSS for the element, including which styles came from which CSS file, which were overridden by other stylesheets, etc. You can even edit the styles in the tool and see what changes would look like.
Here you can see the stylesheet f.css overrides several properties from the jqm stylesheet, which sets them in several places and overrides itself with various classes:

Where is CSS for jQuery UI's .ui-selected Defined?

I'm trying to apply jQuery UI Selectable to a portion of my website. However, I do not see either the selection box while dragging the mouse, nor does the color of selected li elements change.
So to understand the problem, I went back to the source:
http://jqueryui.com/demos/selectable/
I see (using IE9 developer tools) that a style .ui-selected is applied to selected elements. Using Trace Styles, IE shows that background-color is originally defined in jquery-ui.css but overridden (ultimately) by #selectable .ui-selected. However, IE does not show the source of #selectable .ui-selected. Searching the jQuery UI style sheet I reference, jquery-ui-1.8.18.custom.css, finds no mention of ui-selected, nor do I find it in jquery.ui.selectable.css.
Where exactly is the demo page getting the CSS for the background color?
I found one of the other jQueryUI demos defines the style for those classes in a custom style sheet, so I ended up following that lead.
http://jqueryui.com/demos/selectable/#serialize
It seems odd that those styles are not part of jQueryUI Themeroller. Perhaps that will change in the future.

is it possible to use jQuery Mobile Forms in my webpage

I love the way jquery mobile renders a form, is it possible to embedded a jquery-mobile-form in a table, div or any container in my webpage?, to be clear: I have a html5 webpage anf the layout is done by divs and css, is it possible to include a jquery-mobile-form in one of the divs.
I have been tried to do that but jquery-mobile-form always takes the 100% of the page, I want to use the form in an specific high/with div container, is that possible?
Thanks!
Yes, you can adjust the size of this forms like any other div elements.
Just wrap the form in a block element and apply the css "width"-attribute on it.
I created a Fiddle for that:
adjust jQueryMobile form size fiddle

<legend> colour when using jQuery UI Theme

I'm using a jQuery UI Theme, which is predominantly white text on a black background. I'm using a <fieldset> with a <legend> and the text of the latter is being display in black on a black background (black being the browser's default font colour).
I've tried applying various jQuery UI Theme CSS classes to the legend (e.g. "ui-widget-content"), but I get too much extra baggage, such as borders and backgrounds, when I just want the text to be white.
Before anyone says "why don't you just make the text white?", I should state that I have switchable themes, so it has to get the colour from the theme's stylesheet.
I know that I can use jQuery to apply the CSS class to all legends, when I know which one I want, thus:
$("legend").addClass("???");
Any help would be greatly appreciated.
I solved the problem by using jQuery to set the <legend> colour to be the same as that of an element with a CSS class of ui-widget-content.
$("legend").css("color", $(".ui-widget-content").css("color"));
Obviously, this depends on there actually being an element with that class present. For my purposes, I know there always will be.

Resources