Datepicker calls error - javascript

I use that datepicker (http://t1m0n.name/air-datepicker/docs/), and when I call him with my parameters from JS - he doesn't work. And when I use class datepicker-here - works, but I need to use with my config.
Look: https://jsfiddle.net/MyZik/3j2j7xe2/22/
Thanks in advance.

Change this:
<input type="text"
id="#datepicker1"
name="available_time"
class="form-control"
placeholder="Время активации">
to this:
<input type="text"
id="datepicker1"
name="available_time"
class="form-control"
placeholder="Время активации">
what changed is the id. You don't need any # for id attribute in HTML.

Related

Implementing form masking js

To implement form masking I followed this example:
http://html.codedthemes.com/gradient-able/default/form-masking.html
Instead of this:
<input type="text" class="form-control date" data-mask="99/99/9999">
I want to do this:
<input type="text" class="form-control date" data-mask="99.99.9999">
These scripts are involved:
<script src="../files/assets/pages/form-masking/inputmask.js"></script>
<script src="../files/assets/pages/form-masking/jquery.inputmask.js"></script>
<script src="../files/assets/pages/form-masking/autoNumeric.js"></script>
<script src="../files/assets/pages/form-masking/form-mask.js"></script>
I changed form-mask.js to start like this:
'use strict';$(function(){$(".date").inputmask({mask:"99.99.9999"});
But that didnt do it.
You can try this.
You have the part correct that gets all the fields with date in it.
Then, you have to change the data-mask attribute. Since its a generic field, we use the jquery function attr for that.
$(".date").attr('data-mask','99.99.9999');
http://api.jquery.com/attr/

How to set contents of a BootStrap Input Group using jQuery?

Below is an example of Bootstrap Code to create a input-group. How can I use jQuery to set the contents of the input-group using the id?
<div class = "container">
<div class = "input-group-addon">Your name</span>
<input type="text" class="form-control" id="inputField" placeholder="Full Name">
</div><br>
Also, is there a way I can make the input-group not editable. I want to use it to display read-only text.
$("inputField").???? <-- What goes here??
Thanks!!
$("#inputField").attr('readonly',true).val('myValue')
if you have access to the html put directly readonly="readonly" as attribute of input.
you can put value directly in HTML with the value attribute.
ps: dont forget the "#"
$('#inputField').val('the value');

jQuery: check input with name attribute for hasClass

What I'm trying to do is check if input with name attribute "Name" has a class of "input-validation-error", if so apply css to the label with for attribute of "Name".
if ($("input[name='Name']").hasClass("input-validation-error"))
{
$("label[for='Name']").css("color:red");
console.log('here');
}
This doesn't seem to work. Any ideas?
Markup:
<label for="Name">Name</label>
<input class="input-validation-error" data-val="true" data-val-required="field is required" id="Name" name="Name" placeholder="Full Name" type="text" value="">
Instead of
$("label[for='Name']").css("color:red");
Try
$("label[for='Name']").css("color","red");
Read more on .css() here
OR
Instead of
$("label[for='Name']").css("color:red");
Try
$("label[for='Name']").attr("style","color:red");
The html provided in updated question and with above jquery modification its working see here.
As per the questioner comments below this answer , i think the questioner is adding HTML dynamically inside DOM so in that case use event delegation read more here.

How to retrive name property of previous attribute

hi i am newbie in jquery..
i have code like follow
<input type="text" name="name" id="name">
Remove
my question is how can i pass name property of textbox in function dele()?
i am trying to do is
<input type="text" name="name" id="name">
Remove
but it's giving me error. i don't how can i retrieve it?
Thanks in advance
try this:
<input type="text" name="name" id="name">
Remove
jQuery
$(document).ready(function(){
$('.link').click(function(){
var name = $(this).prev().attr('name');
});
});
prev is a method that comes with jQuery. this is an instance of JS Native DOM element. use $(this) to make a jQuery Instance.
dele($(this).prev().attr('name'))

INPUT TEXT remove browser default dropdown

how can i remove the focusin dropdown that you see in this image?
by css or javascript? How?
thanks.
Use autocomplete="off":
<input type="text" autocomplete="off">
However, this is a non-standard attribute for HTML version < 5. In HTML5 you can freely use this attribute, see the reference:
http://www.w3.org/TR/html5/the-form-element.html#attr-form-autocomplete
If that's input of type text then you can do it by specifying attribute autocomplete:
<input type="text" autocomplete="off"/>
Attribute for <INPUT ...>
AUTOCOMPLETE = ON | OFF
<input type="text" autocomplete="off">
Good read
How to Turn Off Form Autocompletion

Categories

Resources