disabling the button. when cells in the schedule are unchecked [closed] - javascript

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
How to disable the save button when all checkboxes are unchecked, and if at least one hour selected in the schedule will be, the save button becomes active?
Please help.
My code:
https://stackblitz.com/edit/angular-ivy-slrmqc?fbclid=IwAR3mZbHjz8TkLUZJI1kd7gsMnaPikdS0eyGzdF17RPYJ70jyHhXMOzW8x3w&file=src%2Fapp%2Fapp.component.ts

You can add checkIsAllUnchecked method
checkIsAllUnchecked() {
this.isAllUnchecked = this.arr.every((row) =>
row.items.every((col) => col === 0)
);
}
and call it in ngOnInit, click and toggleRow methods
and add the check to the Save button
<button [disabled]="isAllUnchecked" (click)="save()">Save</button>

Related

How do I check if an id is 'active'? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I have buttons that change color when selected or when "active". Each button holds information to do calculations but when one of the buttons is pressed I need to make a box that holds one of the outputs null. I believe the easiest way to do it would be to place this in my calculations code:
if "button id" is "active"
set value to null
I do not know how to translate that english into javascript.
The ids are what I am giving the CSS ".active" attribute to. Fairly new to the stack overflow thing so if this does not make sense or more information is needed please let me know.
Thanks!
function myfunc(reed) {
if (reed.classList.contains("active")) {
document.getElementById("demon").innerHTML = "Yes I contain .active";
} else {
document.getElementById("demon").innerHTML = "No, sorry not having .active";
}
}
<button class="notactive" onclick="myfunc(this)">Not active</button>
<button class="Iam active" onclick="myfunc(this)">I am active</button>
<span id="demon"></span>

unable to deal with empty field in my code [closed]

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 5 years ago.
Improve this question
Here I need to provide officename to find the address ,but one challenge which I am facing that if user does not type anything and hit search button then I want to acknowledge them to fill the req input.
I have implemented one function also that will get invocked when someone hits the search button.But I am unable to proceed for further execution.
You can do it something like this:
var searchText = document.getElementById('<ID_OF_INPUT_FIELD>').value;
if(!searchText) {
alert('Please enter something');
}
<input id =“officeInput” name=“officeiupit” size=“35”>
Point to critical input fields and save in global variables:
oOf=document.getElementById(‘officeInput’);
When a search button has been clicked, make a copy of the textbook content inside your function which you've made:
var sInputText=oOf.value;
In this case inside your function just put
if(!sInputText)
alert(“You must enter an input.“);

How to write Java script that advances to a link after a link has been clicked "X" # of times [closed]

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'm working on a Text-Adventure port of The Stanley Parable, and one of the endings requires pressing a button for 8 hours. Instead of 8 Hours, I want the game to advance to the next link after 800 clicks on the link, any idea how I would code this?
Try this. Its simple but you get the idea. Rest you should try to accomplish yourself.
var clicks = 0;
document.getElementById('button').onclick = function(){
clicks++;
if(clicks == 5) {
window.location.href = 'www.yourlink.com';
}
}
<button id="button">
Click
</button>

HTML - Calling Javascript Function with variable? [closed]

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
So I am trying to do a button and if you click on it then it calls a function called order(). So, If I'm trying to do something like this order("+<script>blablabla</script>+") then it shows me a error if I type into something between the "+HERE+" Why that? Is there any way around it?
You could always do something like this. Maybe change the divs around a bit and add a rounding system. This gives you a live update on the costs when selecting how many keys.
https://jsfiddle.net/8hube9ua/
Throw this under your select,
<span data-val="1.85">1.85</span> <!--How much each key is-->
then throw this into the script.
<script>
$('#suiface').change(function(){
var span = $(this).next('span');
span.text(span.data('val') * parseInt(this.value,10)) //multiplies the cost by the option selected
})
</script>
I'm not sure to understand, but why don't you write something like this ?
<button onclick="order()">Blablabla</button>

Have HTML anchor simulating clicking a different element [closed]

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 9 years ago.
Improve this question
I have something like this:
Vehicle Info
<script type="text/javascript">
function clickVehicleTab() {
$("#vehicle").trigger('click');
}
</script>
The function gets executed, however the jQuery to click the object doesn't seem to be executing successfully. What am I missing?
EDIT:
It appears the bind on the #vehicle object is a problem. It looks like this:
$('#jsddm > #vehicle').bind('click', openVehicleMenu); //vehicle menu click event
So the #vehicle can't be programattically clicked directly the way I'm trying.
A better way to do this would be adding an id to the link and using this to listen to the trigger event. Then when this is entered trigger the click-event on the element with the id "vehicle"
Vehicle Info
$(document).ready(function(){
$("#url").click(function(e){
e.preventDefault();
console.log('TEST: clickVehicleTab entered...');
$("#vehicle").trigger('click');
}
});
If the binding is done programatically why don't you just use:
openVehicleMenu();
instead of
$("#vehicle").trigger('click');

Categories