|
$(document).ready(function(){
var obj1 = { }
var obj2 = { }
if(obj1 === obj2)
{
alert('true');
}
else
{
alert('False');
}
});
Why if(obj1 == obj2) returns false eventhough obj1 and obj2 are objects of same type?
|
|
|
|
|
Because the comparison is to see if they are references to the same object. And as you see they are two different objects.
|
|
|
|
|
OK, but then why then does this return True?
var obj1 = 2;
var obj2 = 2;
if(obj1 === obj2){
alert('true');
} else {
alert('False');
} It's the same code but for assigning an integer to the obj variables rather than an empty JSON string.
|
|
|
|
|
Because the value 2 is a constant so the references will point to the same item.
|
|
|
|
|
If I "Inspect" a pop-up window/message box on chrome browser (by right clicking a web-page in chrome browser) there is a field called "Accessibility".
Under "Accessibility", there are "GenericContainer" which has "list". this list has a number of names as values (e.g. different type of pen).
I would like to copy all values (names) of "list" and separate each value (names) by ";" when I click that pop-up/ message box using a Add-On in Chrome.
How can I make that Add-On?
I understand that I have to write javascript to execute with other .js file, for example, codes in this tutorial-
https:
But I don’t know related function I need to call.
Please keep it in your mind that I am new. Thanks in advance!
PS:
At least provide some tutorial, where I can find related instruction.
|
|
|
|
|
Member 14567950 wrote: Please keep it in your mind that I am new. Then I suggest you start with something simpler. there are many articles around that explain how to writ Chrome addins, but you need a good technical background first.
Member 14567950 wrote: codes in this tutorial-
https://markb.uk/building-a-simple-google-chrome-extension.html
But I don’t know related function I need to call. Try contacting the author for advice.
|
|
|
|
|
<SCRIPT language="javascript" type="text/javascript">
function salary()
{
a=Number(document.calculator.hourlyrate.value);
b=Number(document.calculator.hoursworked.value);
c=Number(document.calculator.weeks.value);
d=(a*b*c);
document.calculator.total.value=d;
}
function points()
{
a=Number(document.calculator.age.value);
b=Number(document.calculator.yos.value);
c=((a*2)+b);
document.calculator.total2.value=c;
if (c < 60) {
document.calculator.EmployerContribution.value="You are at 1% Employer Contribution";
}
else if (c > 60 && c < 89) {
document.calculator.EmployerContribution.value="You are at 3% Employer Contribution";
}
else if (c > 90 && c < 119) {
document.calculator.EmployerContribution.value="You are at 5% Employer Contribution";
}
else if (c >= 120) {
document.calculator.EmployerContribution.value="You are at 7% Employer Contribution";
}
}
</SCRIPT>
I am trying to take the value from for the salary() function and use it with the points function().
|
|
|
|
|
Add a return statement to the end of the salary function so you can capture its result. See JavaScript Functions[^].
|
|
|
|
|
I have the same problem with you, hope someone could help this pout
|
|
|
|
|
wrote: I have the same problem with you, hope someone could help this pout An answer was given 5 days previous to your post. And it's very, very basic understanding of programming.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
The account you're replying to was a spammer:
spammer in forums - rinave - gone[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
As Richard already answered, but it appears another user did not understand, at the end of the salary function add
return d But you really should change the variable names to something that makes sense.
Then, in the point function you can do something simple like this:
var sal = salary();
sal will now have the return value from the salary function and you can use it however you need to.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
I would expect the following two expressions to both evaluate to false:
2 < "12"
"2" < "12"
The second one returns false. That makes sense to me "1" is before "2". In the first case,
we are comparing a number with a string. I would expect the number 1 to be converted to the
string "1" and therefore to evaluate to false. However, it is evaluating to true. What am I missing?
Thanks,
Bob
|
|
|
|
|
BobInNJ wrote: it is evaluating to true
BobInNJ wrote: 2 < "12"
12 is getting converted to int.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
Comparing data of different types may give unexpected results.
When comparing a string with a number, JavaScript will convert the string to a number when doing the comparison.
When comparing two strings, "2" will be greater than "12", because (alphabetically) 1 is less than 2.
|
|
|
|
|
How to delete consumer in kong using java script by nodered?
|
|
|
|
|
Probably by writing some code to handle the delete action.
|
|
|
|
|
What does any of this mean?
It sounds like you're trying to hack something. Bad idea.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
I'm pretty green with Vue & TypeScript and I'm looking to just build some components. I can find lots of pre-rolled things but this is a learning exercise.
I'm struggling to find a decent article or blog post using all these techs. Dose anywhere here have some good up-to-date links to articles or blog posts?
|
|
|
|
|
Quote: I'm looking to just build some components. Then build them, what's stopping you?
Quote: I'm struggling to find a decent article or blog post using all these techs. That is because you have a pretty tight filter applied there. Bootstrap is going to be intrinsic. Try finding for TypeScript and Vue article with Router, Bootstrap can be applied yourself—since you are pretty green in Vue, right?
A quick Google search for "vue router typescript" did yield the following for me,
TypeScript Support — Vue.js
VueTyped - VueRouter Example #2 - Plunker
Adding the bootstrap can be done using their CDN links. You can follow the same approach I used above to find what you are looking for on the Google.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
hi,
I need to open a word file which saved in server in client side(without open/save dialog and not download in client system) and let users to edit it. then save back this file in server again.
I try
Word.ApplicationClass for this, but it open word file in server side.
do you know any component or code in asp.net for doing this??
please answer and help me asap.
best regards.
|
|
|
|
|
Please do not post the same question in multiple forums.
|
|
|
|
|
Greetings again experts,
We have a requirement that when our web app loads, by default, the submit button is disabled:
Here is how I handled that:
<asp:Button runat="server" id="btnSubmit" style="width:120px;padding: 0; border: 0;background-color:#D8D8D8 !important;color: #808080; height:30px;" Text="Generate Report" OnClick="btnSubmit_Click" Enabled="false" />
Then we have six search textbox controls.
When a user enters a value of at least three characters into any of the textboxes, then the submit button is activated.
Here is the script that I am using for that:
script type="text/javascript">
function SetButtonStatus(sender, target) {
var uuid = document.getElementById('<%=suuid.ClientID %>');
var calllist = document.getElementById('<%=caller_list_id.ClientID %>');
var phone = document.getElementById('<%=phonenumber.ClientID %>');
var startdate = document.getElementById('<%=date_start.ClientID %>');
var enddate = document.getElementById('<%=date_end.ClientID %>');
var calltype = document.getElementById('<%=call_type.ClientID %>');
if ((((((sender.value.length >= 3 || uuid.value.length >= 3) || (sender.value.length >= 3 || calllist.value.length >= 3) || (sender.value.length >= 3 || phone.value.length >= 3) || (sender.value.length >= 3 || startdate.value.length >= 3) || (sender.value.length >= 3 || enddate.value.length >= 3) || (sender.value.length >= 3 || calltype.value.length >= 3))))))
document.getElementById(target).disabled = false;
else
document.getElementById(target).disabled = true;
}
</script>
On each of the six search boxes, I call this function like this (just one textbox as an example):
<asp:TextBox id="phonenumber" style="width:150px;" class="form-control" onkeyup="SetButtonStatus(this,'btnSubmit')" runat="server" />
This works good so far.
The issue we are having is that when a user enters value via mouse, then submit button is not activated.
Most users have their autoComplete on such that when a user has entered a value before, next time s/he wishes to use that value again, s/he simply double click the search textbox and selects a pull down value with his/her mouse.
In this case, the button does not get activated.
I am trying to use the following script so submit button can be activated when mouse click on any textbox is detected:
<script type="text/javascript">
$(document).ready(function() {
$("input").keypress(function(e) {
if (e.which == 254) {
$('#btnSubmit').click();
return false;
}
return true;
});
});
</script>
It still does not work as the submit button remains disabled.
I tried keycode===13 and still no love.
Any ideas how I can resolve this?
Thanks a lo in advance
modified 6-Jun-19 12:05pm.
|
|
|
|
|
Assuming you want to test all text inputs in the form, then something like this should work:
$(function(){
var inputSelector = "input:not([type=button]):not([type=submit]):not([type=reset])";
$(document).on("change blur keyup input", inputSelector, function(e){
var validInputs = $(inputSelector).filter(function(index, element) { return element.value.length >= 3; });
document.getElementById("btnSubmit").disabled = validInputs.length === 0;
});
}); Edit fiddle - JSFiddle[^]
.filter() | jQuery API Documentation[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
WOW!
Always very happy to see you pick up my threads because the solution you provide ALWAYS works!
This one didn't disappoint either.
It works perfectly.
Thank you very much Richard.
Really appreciate your help.
|
|
|
|