I am using a < mat-label> tag for displaying Title Text. The label and text css class needs to be displayed (or hidden) based on where the component is being called from (which passes conditions)
<mat-label [class]="conditionA? 'label-h3' : conditionB? '' : 'label-h2'">{{ conditionA? 'TitleA' : (conditionC? 'TitleB' :'') }}</mat-label>
<mat-chip-list #chipList>
... some code here ..
</mat-chip-list>
The problem is that label is working fine for the first time but when I play around in application and come back, then title text is blank.
I have checked by printing conditions and text. They are correct and same for the first time and after I come back. The HTML element itself for the mat-label is not generated in the later case.
Related
Please first click the link to the image below to understand my question/situation.
If the text below a particular species icon (circle with animal image inside it) is bold, I would like that to be used as input criteria for getting information from a database. In other words, I want to use the font-weight CSS property of a "< p >" element as an input. Only one "species text" can be bold at a time.
For example, if I have "D. rerio" selected (its font is bold) and I click the "search" button, I would like for the back-end to know that it needs to pull information from the "D. rerio" database specifically.
Rather than trying to send the value of the CSS, you should use the same process that sets the CSS to set a value in a hidden field. Something like:
<input type="hidden" name="species" id="id_species">
...
$("#fishIcon").click(function(){
$("#fishIconText").css("font-weight", "700")
$('#id_species').val('fish')
});
See the code example below. When you select the text in the first input and drag it to the second input, what you are left with in the second input is just the text 'questions'.
Can anyone explain why this happens and if there's a way to keep all the text when dragging?
Thanks!
<input type="text" value="http://stackoverflow.com/questions"/>
<input type="text"/>
Attempt to drag some text from a text input to an empty text input. It will fail, and will raise an assert in debug builds:
ASSERT(oldLength >= selectionLength);
I think this is because WebCore is calculating oldLength from the wrong element; it looks like it's calculating the length of the text field being dragged to rather than the text field being dragged from.
I have a custom Visual Force page that on load has a name field that is supposed to have {Auto} printed inside the input text box that the user can delete or leave or not. I have been using a html-placeholder however the text just disappears and is gray.
My VF inputfield:
<apex:inputfield required="true"
value="{!EventPackageRevenueBreakdown__c.Name}" html-placeholder="{!Auto}"></apex:inputfield>
What it looks like with that code:
What I need it to look like (notice the cursor is after the closing scope)
Thanks in advance I'm still very new to this!
I suggest you to set Name field in controller with '{Auto}' value.
The placeholder attribute will disappear when there is a value in the field, what you want is to actually set the VALUE of the field to {Auto}.
Try this:
If you want it to automatically clear the field if a user clicks into it, you could add some javascript to handle that.
The search bar here uses the following code with placeholder text and en empty value to search everything by default:
if(CleanSQLText(Request.Querystring("Q"))="") then
SearchQuery=""
<input type="text" placeholder="e.g. Shops" name="Q" value="<%=SearchQuery%>" onclick="if (this.defaultValue == this.value) { this.value = ''; }">
The problem is when no value is entered and no selects chosen, the results keep using the old value 'e.g. Shops', which changed to placeholder text.
Search results heading:
<h2 class="searchResults">Businesses matching "<%=SearchQuery%>"</h2>
How can that happen when there is no value?
The placeholder text is actual text in the box. And ASP.NET is doing something funky to get it to behave like it does. I haven't used it too much because of ASP.NET's weirdness but its perfectly valid.
What is happening is that the text box has your prompt text and they click search so it isn't empty like you think it should be.
You could put an if(text != 'My Prompt Text').
If your prompt text is a valid search the user could use, then I would suggest you track if the user has clicked on the text box with jQuery, the onclick even, and a Boolean stored as an attr on that element.
There was a question previously on how to show hints in a text field (html form field), which clears automatically when the user clicks on the field under consideration. As in, when the field gets focus, the hint displayed inside the form gets cleared without the user having to manually delete the characters.
The solution given (and it works perfectly) -
<input onfocus="if (this.value=='search') this.value = ''" type="text" value="search">
Now my question is, how do you format the text that is displayed as the hint (in this case "search"). By formatting, i would want it to be in a certain color and font type.
I can do this to the other fields, which do not have this preloaded hint in it, by using css-
color:#123123; font-family:calibri;
Thanks!
You're asking about styling the content (value) of an input element.
You can use regular CSS for this:
input {
color:#123123;
font-family:Calibri;
}
Working example: http://jsfiddle.net/fxxp4/