I want effect .alt to remove , from a form input in Vue.js.
<input type="text" v-model="tempSkill" #keyup.alt="addSkill" />
#keyup.alt removes the , after an input on Windows but it isn't working for me on Macbook. [#keyup.alt should remove , after skillI want to remove the , after the skills](https://i.stack.imgur.com/Fi7Wt.png)
I added .alt after #keyup.
I also tried other key combinations with Alt but none worked.
When I use .alt, it doesn't work at all.[enter image description here](https://i.stack.imgur.com/xkMFH.png)
Related
I'm trying to make a bot that creates accounts for me, but I can't interact with the element where I need to send my credentials.
All I know is that the element that I'm trying to interact with is generated in javascript, after clicking on another button. I found multiple answers but all were in others languages than Node.js.
I'm trying to send credentials on this element:
<input type="text" name="pseudo" id="pseudo" placeholder="Mon pseudo légendaire" style="margin-bottom: 10px;" maxlength="10">
I tried to use this:
driver.findElement(By.xpath('//*[#id="pseudo"]')).sendKeys('CREDITENTIALS')
Which returns me this error: Webdrivererror: element is not visible.
HTML element code looks like this :
<input type="text" name="pseudo" id="pseudo" placeholder="Mon pseudo légendaire" style="margin-bottom: 10px;" maxlength="10">
The problem is not that i have to wait until the element that im trying to interact with is displayed because it is already displayed, the problem is that i want to click on the second element that match with my findElement by xpath, because what im trying to click on is existing 2 times in the html code and only the second one is interactible.
Update (from the comments)
This element is within the following <div> tag:
<div id="modal_message_wrapper" class="block_scrollable_wrapper scrollbar-light yellow noise inscription">
You can construct an unique xpath clubbing up the id, name and placeholder attribute as follows:
driver.findElement(By.xpath("//input[#id='pseudo' and #name='pseudo' and #placeholder='Mon pseudo légendaire']")).sendKeys('CREDITENTIALS')
Update
As you mentioned that the desired element is within:
<div id="modal_message_wrapper" class="block_scrollable_wrapper scrollbar-light yellow noise inscription">
So you can use the following line of code:
driver.findElement(By.xpath("//div[#class='block_scrollable_wrapper scrollbar-light yellow noise inscription' and #id='modal_message_wrapper']//input[#id='pseudo' and #name='pseudo' and #placeholder='Mon pseudo légendaire']")).sendKeys('CREDITENTIALS')
Note: It's quite evident the element is within a Modal Dialog Box, so definitely you have to induce a waiter in the form of WebDriverWait before you attempt to send any character sequence to the <input> element.
Am using JSF and Primefaces .. And i need when i focus on the outlabel the input text gets background color
This is my code :
<p:panelGrid columns="2" layout="grid" style="border:0px none;background:none" styleClass="ui-panelgrid-blank ">
<p:outputLabel value="#{msg.PurchaseReturns_Txt_Document_NO}" />
<p:inputText readonly="true" value="#{quotationMB.instance.object.quotationid}"/>
</p:panelGrid>
<p:panelGrid styleClass="datePick ui-panelgrid-blank " columns="2" layout="grid" style="border:0px none;background:none">
<p:outputLabel value="#{msg.RequestForQuotation_Txt_Date}" />
<p:calendar value="#{quotationMB.instance.object.validto}" locale="de" navigator="true" pattern="yyyy-MMM-dd" showOn="button" />
</p:panelGrid>
*************************JAVA Script*******************************
I have tried this code .. It worked but on the whole input texts that i have in my page :
$('.ui-outputlabel').click(function() {
$(this).find('.ui-inputtext').css('background-color', 'red');
});
There are a few things wrong in your question.
To start off, you cannot focus a p:outputLabel (which is rendered as an HTML label). Clicking the label will focus the linked field. Which brings us to the second issue.
In order for an p:outputLabel to work as specified in the showcase (validation errors, error styling, required indicator, etc.), you need to use the for attribute to link it to the input component (as in regular HTML).
So, if you add for to your labels, you can simply style the input fields using the :focus CSS selector.
Technically you could get your click listener working like this (but that would not make sense):
$("label").click(function(){
document.getElementById(this.htmlFor).style.backgroundColor = "red";
});
It would make more sense to add a focus and blur listener to input fields and use the listeners to toggle a CSS class on the corresponding label. For example:
$("input").focus(function(){
$("label[for=\""+ this.id +"\"]").addClass("focus");
});
$("input").blur(function(){
$("label[for=\""+ this.id +"\"]").removeClass("focus");
});
See also:
Anyway to have a label respond to :focus CSS
I have an URL field in my form.
The validator requires for it to have http:// in front of it,
which I think many people won't understand.
Could I have a "placeholder" that the user cannot delete or write before it?
Example: http:// myinputhere.com
<input type="url" placeholder="http://">
Placeholder doesn't concatenate the placeholder text to the user entered text, it's just for any information you would like to provide to your users, like some programmers do not use label instead they write placeholder for example
<input type="text" placeholder="Enter Username Here" />
So here you can do that is, either you can have a predefined http:// value..
<input type="url" value="http://" />
Or you can use JavaScript or jQuery for client side validation instead of HTML5 type="url" which will give only meaning to your semantics but you cannot rely on HTML5 validation only.
Also if you want to preserve your semantics by using type with a value of search or url than you can disable the HTML5 validation using novalidate attribute for your form tag.
OR
You can use multiple field, one with type set to url and other to text and you can concatenate both the field values ..
input[type=url] {
width: 40px;
}
<input type="url" value="http://" readonly />
<input type="text" />
Demo
Note: Using client side validation like HTML5 and JavaScript can be
easily disabled by your users, I would recommend you to have a server
side validation if this matters to you alot.. But relying on client
side validation ONLY is not good.
Why don't you use javascript in order to do so. I assume that you have any HTML tag like this
<input id="test" type="url" onclick="testJS()" placeholder="http://">
and try this following javascript
function testJS(){
var a = document.getElementById("test");
a.value = "http://";
}
You can display a span element over the input like this:
HTML:
<div class="wrapper">
<input type="url" />
<span>http://</span>
</div>
CSS:
.wrapper {
position: relative;
}
input {
padding-left: 48px;
}
.wrapper span {
position: absolute;
left: 2px;
}
Example
No, you cannot have initial content that cannot be deleted.
The question implies a wrong approach because a) users may need to delete http:// e.g. if they need to enter an https: URL, b) placeholders aren’t for this, c) if you use value="http://", it’s not a meaningful default value and it makes the control initially invalid, d) if you use type="url", you are asking for a control that takes an absolute URL as value and leaving it to browsers to implement that.
What you can do to help users who don’t know how to type an absolute URL is to use a title attribute, which has a special function in a context like this: its value will appear in an error message shown by the browser, if the user tries to submit the form when the control value is invalid. Example:
<input type="url" title="An absolute URL (usually starts with http://)">
You can either use Javascript and jQuery to do this. (still searching for solution)
Or you can put the http:// text in the text box with:
<input type='url' value='http://'>
Or you can add some text in front of the text box and then accept the input to be without the http:// text
<p style='display: inline-block'>http://</p><input type='url' style='display: inline-block'>
You can also use css positioning to show a span element on the input box and then add padding to the input box so that the user input won't go over the span element.
I have a page where you can click a link that says "add a keyword" and an input will appear and you can enter the keyword, and then convert it into a span tag on blur or the "return" key. However, I've been adding onto it to allow for an "autocomplete" feature, so I'm trying to insert a
<ul></ul>
after my input in order to do a .load inside the list.
The relevant code I have is:
var addKeywordId = 0;
$('a.add_keyword').live('click', function(){
$(this).before('<input type="text" class="add_keyword" id="addKeyword'+addKeywordId+'" /><ul><li>hi</li></ul>');
$('.add_keyword').focus();
addKeywordId++;
});
The problem is, that my HTML structure ends up looking like this:
<ul><li>hi</li></ul>
<a class="add_keyword">+ add keyword</a>
<input id="addKeyword0" class="add_keyword" type="text />
INSTEAD OF
<input id="addKeyword0" class="add_keyword" type="text />
<ul><li>hi</li></ul>
<a class="add_keyword">+ add keyword</a>
Anybody know why my HTML is added out of the order I specified??
Thanks
EDIT: This seems to be working fine in Google Chrome, but not in Mozilla Firefox.. :(
This is likely due to the weird rejiggering of code Firefox does to try to display things even when there are errors. I've seen it where I miss a closing div, IE freaks out (as it should) and Firefox looks fine, as it ignores that you missed adding the ending div and guesses.
You could try a 2 stage thing. I would add an id to the ul tag, then add the input before it.
$(this).before('<ul id="ulid"><li>hi</li></ul>');
$('#ulid').before('<input type="text" class="add_keyword" id="addKeyword'+addKeywordId+'" />');
Happy haxin.
_wryteowl
Have a look at this link.
The menu to the left is not clickable in chrome (When you open in new tab, it works fine), but works fine in Mozilla.
Please let me know if you have any thoughts on how to correct this.
Your menu not using Javascript to detect click events it is anchor tag. You will notice that in a webkit browser hovering over the link does not provide a pointer cursor.
Eg:
<a style="background-color:red;" href="/stores/unwrapindia/products/1/Artisan/2/Happily-Unmarried/65/New-Year/78/Promotions-">
<div class="fillDIV">
<input type="checkbox" name="attribute_value_44" value="44" class="CheckBoxClass" id="CheckBox1">
<label class="LabelSelected" for="CheckBox1" id="Label1">Chandigarh</label>
</div>
</a>
The problem could that the input is conflicting with the anchor tag in regards to the click event, because webkit is a bit confused about the div inside the anchor or you need to clean up your ID's. I do not see the reason for your using of the input and label, so at least test it with just the anchor.
The label elements within your links have a for attribute (which refer to hidden checkboxes). Something like:
<input type="checkbox" id="cb1" />
<label for="cb1">mooooo</label>
The link does not work once you set that attribute.
To fix your problem, simply remove the attribute - it does not benefit you anyway (having the checkbox checked is not helpful as you are navigating away from the page).
Here is an example.
My solution is add inline javascript code to tag A
onclick="document.location.href=this.getAttribute('href');"
Note
In html specification, an A element is not allowed to contain a DIV element, you can refer to
http://www.w3.org/TR/html4/sgml/dtd.html
for more information