Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
i Have Two Question About Bootstarp Slider
First How can I use change event in BootstrapSlider and get value
and Second is how to change initial value of bootstrap slider
You can use .on('chnage', callback_function) to listen to value changes
and set the data-slider-value=< any number > to initialize the starting value
<input
type="text"
name="somename"
data-slider-value="20"
data-provide="slider"
data-slider-min="1"
data-slider-max="100"
data-slider-step="1"
data-slider-tooltip="hide"
>
// Instantiate a slider
var mySlider = $("input").slider();
//This will get called for every chnage
mySlider.on('change',function(){
//getting value from slider
var value = mySlider.slider('getValue');
console.log(value)
})
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
When I play a sound with js, I just want the sound coming from the right. how can I do that
Yes. Check out StereoPannerNode from the Web Audio API.
The pan property takes a unitless value between -1 (full left pan) and
1 (full right pan). This interface was introduced as a much simpler
way to apply a simple panning effect than having to use a full
PannerNode.
Also see this example: https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Using_Web_Audio_API#Adding_stereo_panning_to_our_app:
const pannerOptions = { pan: 0 };
const panner = new StereoPannerNode(audioContext, pannerOptions);
<input type="range" id="panner" min="-1" max="1" value="0" step="0.01">
const pannerControl = document.querySelector('#panner');
pannerControl.addEventListener('input', function() {
panner.pan.value = this.value;
}, false);
track.connect(gainNode).connect(panner).connect(audioContext.destination);
(Note: this isn't specific to Vue)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
From the screenshot below, two questions as newbie of javascript developer.
I want to directly get the value of the second td from $('#cart-subtotal-order.total.subtotal td') in javascript code. That is the first question. The second question is how to get the value of $('.amount grand-total'). Is it right to use val() for that like this $('.amount grand-total').val() or should I use text() for the regular text value for that?
HTML Body elements source screenshot
if you wat to get second td from tr:
var subtotal = $('#cart-subtotal-order.total.subtotal').find("td:eq(1)").text();
then if you want to get grand total is like:
var grand_total = $('#totalRow .grand-total').text();
For Getting Second row text, you can use the following code
var seondRow = $("table>#cart-subtotal-order.total.subtotal> td:nth-child(2)").text();
For Getting the grand total
var grandTotal = $('#totalRow .grand-total').text();
or
var grandTotal = $('#totalRow .grand-total').value();
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to make a list in HTML and then the user selects the list and then do something with the selections.
For example. List of fruits. Apple bannana, grapes.
User selects grapes and if grapes is selected asked how many grapes?
I would like to know how i can do this in Javascript or Jquery
Use this code block. As simple as that,
//generates the list
var items = 'Apple, bannana, grapes';
var nHtml = '';
items = items.split(',');
items.forEach(function(v){
//trim() will remove the blank spaces
nHtml+='<li>'+ v.trim() +'</li>';
});
$('#itemList').append('<ul>'+ nHtml +'</ul>');
//detect click on the list item
$('li').click(function(){
var name = $(this).text();
var question = 'How many '+name+' ?';
$('#question').html('<span>'+ question +'</span><input type="text" id="answer" />')
});
//get the number feed into the text box
function getCount(){
var answer = $('#answer').val();
console.log(answer);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='itemList'></div>
<div id='question'></div>
<button onclick='getCount()'>Get Count</button>
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am working in MVC C#. I have a table with Enum values. I got 2 conditions in Enum as On and Off. I want my text box to be Enabled during On and Disabled during Off. How to do this ? kindly help.
My text box as follows:
<div ><p class="form_text1">Start</p> <input type="text" id="EditStart" name="EditStart" class="form-control">
</div>
If you want a bit more of a generic approach, you can do this through C# instead of JavaScript. However, I am unsure how you are getting this enum so my answer might not work. Hope this helps.
public static MvcHtmlString EnumTextBox(this HtmlHelper<TModel> htmlHelper,
YourEnum enum)
{
object attributes = null;
if(enum == YourEnum.Off)
{
attributes = new
{
disabled = "disabled"
};
}
return htmlHelper.TextBox("YourTextBoxName", null, attributes);
}
Note: I did not test this, just wrote it out from head.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have an input with an id of name:
<input type="text" id="name">
When I run document.getElementById("name") in the console, I get the element itself (<input type="text" id="name">), but as soon as I assign it to a variable (var name = document.getElementById("name");), I get the string "[object HTMLInputElement]".
Why does that happen? Why can't I just get the selected input element, instead of the input element object?
Thanks.
if you use without
var name = document.getElementById("name")
or any other variable than name,
var myvar = document.getElementById("name")
you'll get
<input type="text" id="name">
name is property of some DOM elements.
have a look up here