Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Client-side Scripting _ HTML/JS help

Posted by: skyward Feb 16 2016, 02:16 AM

Hi

I am absolutely new to html and javascript. I have developed a simple form in html that is checked through a js function through an onClick event. The problem is that the function is not being executed although there does not seem to be any errors. i have checked it through the w3school debugger and firebug but i am really confused because i DON'T KNOW whats wrong. I need urgent help with this and will appreciate any pointers.

thanks

here is the code

<!DOCTYPE html>
<HTML>
<HEAD>
<title>Online Job Portal</title>

<script type="text/javascript">

function checkForm()
{
document.write("Working");
var chk=true;

var name=document.getElementById("fullname").value;
var age=document.getElementById("getage").value;
var under=document.getElementById("under").checked;
var grad=document.getElementById("grad").checked;

if(name==""){
chk=false;
window.alert("Name is required");}
if(isNaN(age)||age<1||age>100){
chk=false;
window.alert("Enter Valid Age");}
if(under==false && grad==false){
chk=false;
window.alert("Select Qualification");}

if(chk==false){
document.getElementById("info").innerHTML="Please give your information correctly";}

if (chk==false){
var qual=document.getElementById("under").checked;
var it=document.getElementById("it").checked;
var marketing=document.getElementById("marketing").checked;
var academics=document.getElementById("academics").checked;

if(qual==true){
qual="Undergraduate";}
else{
qual="Graduate";}

if (it==true){
it="IT";}
else{
it="None";}

if (marketing==true){
marketing="Marketing";}
else{
marketing="None";}

if (academics==true){
academics="Academics";}
else{
academics="None";}

document.getElementById("info").innerHTML=
"Hello"+fullname<br>
"Your age is "+age" years"<br>
"Your qualification is" + qual<br>
"Your selected job types are"<br>
"Job 1 :" + it<br>
"Job 2 :" + marketing<br>
"Job 3 :" + academics<br>;
}
}
</script>
</HEAD>
<BODY>
<form name="job portal" action="">
<h1>Online Job Portal</h1>

<TABLE>
<tr>
<td>Name :</td>
<td><input type="text"
id="fullname"
name="fullname"
value=""></td>

</tr>
<tr>
<td>Age :</td>
<td><input type="text"
id="getage"
name="getage"
value=""></td>

</tr>
<tr>
<td>Qualification :</td>
<td>UnderGraduate<input type="radio"
name="qualification"
id="under"
value="undergraduate"></td>

<td>Graduate<input type="radio"
name="qualification"
id="grad"
value="graduate"></td>
</tr>
<tr> <td>Select a job type :</td>
<td>IT<input type="checkbox"
name="selectJobType"
id="it"
value="it"></td>
<td>Marketing<input type="checkbox"
name="selectJobType"
id="marketing"
value="marketing"></td>
<td>Academics<input type="checkbox"
name="selectJobType"
id="academics"
value="academics"></td>
</tr>
</TABLE>

<br>
<br>
<br>
<br>
<div id="info">
</div>



<input type="button"
value="Show Information"

onClick="checkForm()">

<input type="reset"
value="Reset Form">

</form>
</BODY>
</HTML>

Posted by: pandy Feb 16 2016, 05:29 AM

You seem to have a brace too many at the end of the script.


The closing brace is missing here.

CODE
if (chk==false){
var qual=document.getElementById("under").checked;
var it=document.getElementById("it").checked;
var marketing=document.getElementById("marketing").checked;
var academics=document.getElementById("academics").checked;


The quotes are screwed up in the string. HTML tags must be quoted too and you had missed a quote altogether. You can't have line breaks in the middle of strings either, you must place those at the plus signs.

CODE
document.getElementById("info").innerHTML =
'Hello' +fullname +
'<br> Your age is ' + age + ' years <br> Your qualification is' + qual +
'<br> Your selected job types are <br> Job 1 :' + it +
'<br> Job 2 :' + marketing +
'<br> Job 3 :' + academics +'<br>';


The object is returned instead of the value for fullname. Afraid I don't see why. unsure.gif
But otherwise it works with those corrections.

Posted by: pandy Feb 16 2016, 05:58 AM

Oh, I changed to single quotes out of habit. It doesn't matter for functionality if you use single or double.

Posted by: Christian J Feb 16 2016, 05:58 AM

QUOTE(pandy @ Feb 16 2016, 11:29 AM) *

The object is returned instead of the value for fullname. Afraid I don't see why. unsure.gif

I think the variable "name" should be used instead.

There is no variable called "fullname", it's the ID and NAME value of an INPUT element.



Posted by: pandy Feb 16 2016, 06:04 AM

Duh. I just realized fullname was used in the string, but you beat me to it. Even though I actually wrote fullname myself I had to sprinkle alert(name) all over to realize that. Sigh. ninja.gif

Also, you of course need to remove the document.write at the beginning of the script or that's all you're gonna get.

Posted by: skyward Feb 16 2016, 08:35 AM

QUOTE(pandy @ Feb 16 2016, 06:04 AM) *

Duh. I just realized fullname was used in the string, but you beat me to it. Even though I actually wrote fullname myself I had to sprinkle alert(name) all over to realize that. Sigh. ninja.gif

Also, you of course need to remove the document.write at the beginning of the script or that's all you're gonna get.



Thanks a lot guys for those pointers. I've corrected the mistakes, the braces one at least I figured out ....(SOMTHING at least) sad.gif ....but the function is not doing any checks. So I just wanted to ask, since u said it works, what exactly is it doing...I realiz its stupid to ask...but is it displaying the input info? And is it alerting at the correct points?
And I only added the docment.write at the beginning to check whether the function was running or not.

Posted by: Christian J Feb 16 2016, 08:46 AM

Could you post the corrected version as well?

Posted by: skyward Feb 16 2016, 08:51 AM

QUOTE(Christian J @ Feb 16 2016, 08:46 AM) *

Could you post the corrected version as well?


<!DOCTYPE html>
<HTML>
<HEAD>
<title>Online Job Portal</title>

<script type="text/javascript">

function checkForm()
{
var chk=true;
var name=document.getElementById("fullname").value;
var age=document.getElementById("getage").value;
var under=document.getElementById("under").checked;
var grad=document.getElementById("grad").checked;

if(name==""){
chk=false;
window.alert("Name is required");}
if(isNaN(age)||age<1||age>100){
chk=false;
window.alert("Enter Valid Age");}
if(under==false && grad==false){
chk=false;
window.alert("Select Qualification");}

if(chk==false){
document.getElementById("info").innerHtml="Please give your information correctly";}

if(chk==true){
var qual=document.getElementById("under").checked;
var it=document.getElementById("it").checked;
var marketing=document.getElementById("marketing").checked;
var academics=document.getElementById("academics").checked;
}

if(qual==true){
qual="Undergraduate";}
else{
qual="Graduate";}

if (it==true){
it="IT";}
else{
it="None";}

if (marketing==true){
marketing="Marketing";}
else{
marketing="None";}

if (academics==true){
academics="Academics";}
else{
academics="None";}

document.getElementById("info").innerHtml=
"Hello"+name+
"<br>Your age is "+age" years"+
"<br>Your qualification is" + qual+
"<br>Your selected job types :"+
"<br>Job 1 :" + it+
"<br>Job 2 :" + marketing+
"<br>Job 3 :" + academics;

}
</script>
</HEAD>
<BODY>
<form name="job portal">
<h1>Online Job Portal</h1>

<TABLE>
<tr>
<td>Name :</td>
<td><input type="text"
id="fullname"
name="fullname"
value=""></td>

</tr>
<tr>
<td>Age :</td>
<td><input type="text"
id="getage"
name="getage"
value=""></td>

</tr>
<tr>
<td>Qualification :</td>
<td>UnderGraduate<input type="radio"
name="qualification"
id="under"
value="undergraduate"></td>

<td>Graduate<input type="radio"
name="qualification"
id="grad"
value="graduate"></td>
</tr>
<tr> <td>Select a job type :</td>
<td>IT<input type="checkbox"
name="selectJobType"
id="it"
value="it"></td>
<td>Marketing<input type="checkbox"
name="selectJobType"
id="marketing"
value="marketing"></td>
<td>Academics<input type="checkbox"
name="selectJobType"
id="academics"
value="academics"></td>
</tr>
</TABLE>

<br>
<br>
<br>
<br>

<div id="info">
</div>

<input type="button"
value="Show Information"

onClick="checkForm()">

<input type="reset"
value="Reset Form">

</form>
</BODY>
</HTML>

Posted by: skyward Feb 16 2016, 09:08 AM

YAAAY

Its running...only partially but running....i shifted the script from head to body...why does that make any difference? Because I was taught that it's "good practice to write the JS code in the head portion"....

Posted by: pandy Feb 16 2016, 09:20 AM

It shouldn't make any difference in this case. You must have changed something. Everything worked for for me, error checking and the values was printed out.

Posted by: Christian J Feb 16 2016, 09:34 AM

Try using your browser's script console, it should point out (most) syntax errors easily.

QUOTE(skyward @ Feb 16 2016, 02:51 PM) *

function checkForm()
{
var chk=true;

Sidenote: I'd start with a false value instead, and only change it to true if the user input is correct.

QUOTE
document.getElementById("info").innerHtml="Please give your information correctly";}

That's a typo, it must be innerHTML (note the upper case).


QUOTE
if(chk==true){
var qual=document.getElementById("under").checked;
var it=document.getElementById("it").checked;
var marketing=document.getElementById("marketing").checked;
var academics=document.getElementById("academics").checked;
}

I'd put the rest of the script in the above if(chk==true){...} condition as well.

QUOTE
document.getElementById("info").innerHtml=

innerHTML typo again. wink.gif

QUOTE
"<br>Your age is "+age" years"+

A + sign is missing after the age variable.

QUOTE
<td>UnderGraduate<input type="radio"
name="qualification"
id="under"
value="undergraduate"></td>

<td>Graduate<input type="radio"
name="qualification"
id="grad"
value="graduate"></td>

Sidenote: it's good practice to always make one of a group of radio buttons checked by default. If you need a "no qualification" value, add another radio button for that.

Posted by: pandy Feb 16 2016, 09:38 AM

Here.

QUOTE(skyward @ Feb 16 2016, 02:51 PM) *

CODE
document.getElementById("info").innerHtml=



Should be:

CODE
document.getElementById("info").innerHTML=


It's case sensitive, like everything JavaScript. wink.gif

Posted by: pandy Feb 16 2016, 09:39 AM

Bummer. blush.gif

Posted by: skyward Feb 16 2016, 09:53 AM

QUOTE(pandy @ Feb 16 2016, 09:39 AM) *

Bummer. blush.gif



DOOOOONNNNNEEEEE

Happy to say I found those last errors....though a few hours ago i was ready to give up when u guys gave me the boost.........U were right @Pandy.....the code works fine even in the Head.....don't know what I did to correct it smile.gif......

its just a code ...why am i so happy smile.gif

Thanks a lot Pandy and Christain.... and that was a good competition u both had smile.gif

Posted by: pandy Feb 16 2016, 01:49 PM

Christian is always doing that. Lurks while I do all the hard work then he jumps in with the finishing touch. I feel aso used! IPB Image happy.gif

Did you retype something when you moved the script? That's usually how one screws up.

Posted by: Christian J Feb 16 2016, 03:14 PM

Usually it's pandy that posts first while I'm busy spell checking. sad.gif



Posted by: pandy Feb 16 2016, 04:36 PM

No! Not the final solution. I often miss some detail and then come you... ninja.gif

Posted by: skyward Feb 17 2016, 12:58 AM

QUOTE(pandy @ Feb 16 2016, 04:36 PM) *

No! Not the final solution. I often miss some detail and then come you... ninja.gif



I think the main issue was the innerHtml typo... and the braces (turns out the braces were fine originally)...and the quotes..... blush.gif .lol....small mistakes but i wonder why they went undetected in the debuggers?

Posted by: pandy Feb 17 2016, 02:51 AM

What do you mean by originally? The braces weren't fine in your original post, but innerHTML was written correctly.

What debugger missed the braces and the quotes? Maybe you used the HTML validator. It doesn't check JavaScript.

Posted by: skyward Feb 17 2016, 07:51 AM

QUOTE(pandy @ Feb 17 2016, 02:51 AM) *

What do you mean by originally? The braces weren't fine in your original post, but innerHTML was written correctly.

What debugger missed the braces and the quotes? Maybe you used the HTML validator. It doesn't check JavaScript.



They were logically ok, but I might have mistyped(as in wrong place) one of them, because I put them back where I thought I had out them originally and thats when the code worked perfectly, along with the innerHtml typo.

Yes I used the Html validator because I didn't know it won't check the JavaSript huh.gif wacko.gif ...I also used Firebug. A far as I could understand there were no errors from Firebug, but it was hard to understand the interface blush.gif .

I was pretty much banging around on my own. Thank God I decided to post the issue here otherwise I would ave been at it for the next week smile.gif. Made a brand-new account for that sole purpose:)

Posted by: Christian J Feb 17 2016, 08:40 AM

My browser's script console didn't spot the innerHtml typo either. Maybe it's because an author defined object or property might be named "innerHtml", so it's not technically a syntax error. unsure.gif

Posted by: pandy Feb 17 2016, 01:21 PM

Yes, I think so. I didn't get an error for that either.

Posted by: pandy Feb 17 2016, 01:28 PM

QUOTE(skyward @ Feb 17 2016, 01:51 PM) *

QUOTE(pandy @ Feb 17 2016, 02:51 AM) *

What do you mean by originally? The braces weren't fine in your original post, but innerHTML was written correctly.

What debugger missed the braces and the quotes? Maybe you used the HTML validator. It doesn't check JavaScript.



They were logically ok, but I might have mistyped(as in wrong place) one of them, because I put them back where I thought I had out them originally and thats when the code worked perfectly, along with the innerHtml typo.

Yes I used the Html validator because I didn't know it won't check the JavaSript huh.gif wacko.gif ...I also used Firebug. A far as I could understand there were no errors from Firebug, but it was hard to understand the interface blush.gif .

I was pretty much banging around on my own. Thank God I decided to post the issue here otherwise I would ave been at it for the next week smile.gif. Made a brand-new account for that sole purpose:)



I mean the code you originally posted, surely you must have gotten errors for that?

The HTML validator can give you errors for your embedded scripts, but that's because it sees them as HTML and some characters, like slashes, can trigger errors. Can be good to know.

I'm not comfortable with Firebug either. Christian, has FF removed the old JS console, or is it just me that can't find it? K-Mel still has it and that's what I use most of the time.

Posted by: Christian J Feb 17 2016, 03:57 PM

QUOTE(pandy @ Feb 17 2016, 07:28 PM) *

Christian, has FF removed the old JS console, or is it just me that can't find it? K-Mel still has it and that's what I use most of the time.

FF uses something called Developer Tools, that you can access either by right clicking on the page and choose Inspect Element or from Tools > Web Developer > ... I don't think it's the same as K-Mel's Error Console.

Posted by: pandy Feb 17 2016, 06:11 PM

I don't get any of those things to show me JS errors. I may remember wrong, but I think FF used to have a normal error console too. Maybe it's been gone for years. I only use FF when asked to.

Posted by: Christian J Feb 17 2016, 07:03 PM

QUOTE(pandy @ Feb 18 2016, 12:11 AM) *

I don't get any of those things to show me JS errors.

Click on the Console tab, and JS if necessary. But I'm not too familiar with it.

QUOTE
I may remember wrong, but I think FF used to have a normal error console too. Maybe it's been gone for years.

Yes I think so.


Posted by: CharlesEF Feb 17 2016, 08:20 PM

I use Firefox with Firebug installed also. It has an error console, script debugger, NET tab so I can see results of GET and POST among other things, CSS and DOM editors. In fact I don't even use/understand everything it has to offer.

Posted by: pandy Feb 18 2016, 01:11 AM

QUOTE(Christian J @ Feb 18 2016, 01:03 AM) *

Click on the Console tab, and JS if necessary. But I'm not too familiar with it.

In Firebug? Console and Script are on the same level so it's either or. No JS tab. If I click Script I get ta lot of info but not about errors. If a page doesn't contain JS I get the below, so it seems it doesn't report errors...

No Javascript on this page

If <script> tags have a "type" attribute, it should equal "text/javascript" or "application/javascript". Also scripts must be parsable (syntactically correct).

Posted by: pandy Feb 18 2016, 01:17 AM

FYI I don't find anything useful in Iron either (what a surprise...). Does Chrome have an error console? Otherwise what do you use? I think I'm the only one who uses K-Mel here and it seems it's the only modern browser I have that still offers it. Has IE still got it? My version is so old.

Posted by: CharlesEF Feb 18 2016, 02:43 AM

If we are talking about the same thing then yes, in Firebug. Let's take the very first OP posted code as a sample. First I load Firefox, then I turn on Firebug (either by menu or icon). I have Firebug set to full screen behind Firefox. Then I paste the code into a HTML page and load it. Once the page loads I see a superscript number 1 next to the Firebug icon. I click on that number and I'm taken to Firebug with the console tab selected on the first menu bar. On the 2nd menu bar I have 'All' selected. I see this error message:

CODE
SyntaxError: missing; before statement
    "Your age is "+age" years"<br>
    ------------------^
True, the error message is not correct but after I look at it I see the + sign is missing, so I fix the source and reload the page. I see the superscript 1 again so I click on it. I see this error message:
CODE
SyntaxError: expected expression, got ';'
    "Job 3 :" + academics<br>;
    -------------------------^
Again, the error message is not correct but after I look at it I see this block of code is wrong:
CODE
"Hello"+fullname<br>
"Your age is "+age+" years"<br>
"Your qualification is" + qual<br>
"Your selected job types are"<br>
"Job 1 :" + it<br>
"Job 2 :" + marketing<br>
"Job 3 :" + academics<br>;
It should be:
CODE
"Hello"+fullname + "<br>" +
"Your age is "+age+" years<br>" +
"Your qualification is" + qual + "<br>" +
"Your selected job types are<br>" +
"Job 1 :" + it + "<br>" +
"Job 2 :" + marketing + "<br>" +
"Job 3 :" + academics + "<br>";
So I fix the source and load the page again. This time the page loads and no superscript numbers appear. Now I start to test the page. First I want to check validation so I click on the 'Show Information' button. The page blanks out and I see 'Working'. This means document.write was used somewhere and it blanked out the original page so I look at the source to find and comment it out. Now I reload the page again and click on the same button. I see 3 alert messages and this text in the 'info' <div>:
CODE
Hello[object HTMLInputElement]
Your age is years
Your qualification isGraduate
Your selected job types are
Job 1 :None
Job 2 :None
Job 3 :None
At this point I realize there are 2 more errors. First is the '[object HTMLInputElement]' and the 2nd is a logic error. I mean this text should not appear when validation fails. The first error is because the wrong variable name was used. 'fullname' is not a valid variable, it should be 'name'. The 2nd error takes more time because the code is poorly formatted (very hard to read). I do find that this block of code is missing the ending } character:
CODE
if (chk==false){
var qual=document.getElementById("under").checked;
var it=document.getElementById("it").checked;
var marketing=document.getElementById("marketing").checked;
var academics=document.getElementById("academics").checked;
So I fix it by moving 1 of the 2 ending } characters. Again, I reload the page and test the validation again. Now I see this test in the 'info' <div>:
CODE
Hello
Your age is years
Your qualification isGraduate
Your selected job types are
Job 1 :None
Job 2 :None
Job 3 :None
I see that a program logic error remains because this text should not appear. I also realize there is another error. This line 'Your qualification isGraduate' should be 'Your qualification is' because no 'Qualification' radio button was selected.

At this point it would depend on what I had going on with other projects if I continue or not. I mean the lack of good code formatting makes the code hard to read so I would need to spend some time going over it.

When I first read this post you and Christian were already working on it so I stayed out.

Now, are we talking about the same thing?

Posted by: Christian J Feb 18 2016, 05:53 AM

QUOTE(pandy @ Feb 18 2016, 07:11 AM) *

QUOTE(Christian J @ Feb 18 2016, 01:03 AM) *

Click on the Console tab, and JS if necessary. But I'm not too familiar with it.

In Firebug?

No, I was talking about the preinstalled Developer Tools. Firebug is an extension, AFAIK.

Posted by: Christian J Feb 18 2016, 05:59 AM

QUOTE(pandy @ Feb 18 2016, 07:17 AM) *

Does Chrome have an error console?

Yes.

QUOTE
Otherwise what do you use?

Since there can be unique errors in a buggy browser you need to check them all. tongue.gif



Posted by: pandy Feb 18 2016, 07:54 AM

QUOTE(Christian J @ Feb 18 2016, 11:53 AM) *

QUOTE(pandy @ Feb 18 2016, 07:11 AM) *

QUOTE(Christian J @ Feb 18 2016, 01:03 AM) *

Click on the Console tab, and JS if necessary. But I'm not too familiar with it.

In Firebug?

No, I was talking about the preinstalled Developer Tools. Firebug is an extension, AFAIK.


No, I haven't installed any extensions. Firebug shows up under Web Developer. I don't find what you mean. Here's what I've got.


Attached Image

Posted by: pandy Feb 18 2016, 07:55 AM

QUOTE
QUOTE
Otherwise what do you use?

Since there can be unique errors in a buggy browser you need to check them all. tongue.gif


I check that it works.

Posted by: pandy Feb 18 2016, 07:56 AM

QUOTE(CharlesEF @ Feb 18 2016, 08:43 AM) *

If we are talking about the same thing then yes, in Firebug. Let's take the very first OP posted code as a sample. First I load Firefox, then I turn on Firebug (either by menu or icon). I have Firebug set to full screen behind Firefox. Then I paste the code into a HTML page and load it. Once the page loads I see a superscript number 1 next to the Firebug icon. I click on that number and I'm taken to Firebug with the console tab selected on the first menu bar. On the 2nd menu bar I have 'All' selected. I see this error message:[code]SyntaxError: missing; before statement
<snip>

Now, are we talking about the same thing?


Yes, but I don't manage to make FB do what I want. I'll try to follow your description step for step.

Posted by: pandy Feb 18 2016, 08:12 AM

QUOTE(CharlesEF @ Feb 18 2016, 08:43 AM) *

If we are talking about the same thing then yes, in Firebug. Let's take the very first OP posted code as a sample. First I load Firefox, then I turn on Firebug (either by menu or icon). I have Firebug set to full screen behind Firefox. Then I paste the code into a HTML page and load it. Once the page loads I see a superscript number 1 next to the Firebug icon. I click on that number and I'm taken to Firebug with the console tab selected on the first menu bar. On the 2nd menu bar I have 'All' selected. I see this error message:[code]SyntaxError: missing; before statement


Didn't get far. Don't get any superscript number. When I open the console I get a blank page. I've created errors in the script, so it isn't that there are none.

Attached Image

Posted by: Christian J Feb 18 2016, 08:23 AM

QUOTE(pandy @ Feb 18 2016, 01:54 PM) *

No, I haven't installed any extensions. Firebug shows up under Web Developer. I don't find what you mean. Here's what I've got.

Attached Image

I get the same menu, but without Firebug. Maybe it's not included in the Firefox ESR releases (that I use). If you click e.g. the Toogle Tools option you should see the same thing as me (unless Firebug changes things?).

Opera12 has a good javascript error console too.

Posted by: Christian J Feb 18 2016, 08:24 AM

QUOTE(pandy @ Feb 18 2016, 02:12 PM) *

Didn't get far. Don't get any superscript number. When I open the console I get a blank page. I've created errors in the script, so it isn't that there are none.

Have you tried reloading the page after opening Firebug?

Posted by: CharlesEF Feb 18 2016, 11:08 AM

Christian is correct. If you turn on Firebug after you load the page then you must reload the page in order for Firebug to kick in. I replaced the lack of the + sign error and this is what I see:
Attached Image
Notice the 1 next to the Firebug icon? BTW, I did find the problem with the radio and check boxes. This section:

CODE
if (chk==false){
var qual=document.getElementById("under").checked;
var it=document.getElementById("it").checked;
var marketing=document.getElementById("marketing").checked;
var academics=document.getElementById("academics").checked;}
needs to be changed to:
CODE
if (chk==true){
var qual=document.getElementById("under").checked;
var it=document.getElementById("it").checked;
var marketing=document.getElementById("marketing").checked;
var academics=document.getElementById("academics").checked;}
I also found the reason why results were displayed when the validation failed. That if() section that I thought was missing the closing } character had to be moved back to the bottom of the code. Now there are 2 closing } characters at the end like the original code showed. Now when validation fails the only results I see is an actual error message, that I never saw before. This is the section of code:
CODE
if (chk==true){
var qual=document.getElementById("under").checked;
var it=document.getElementById("it").checked;
var marketing=document.getElementById("marketing").checked;
var academics=document.getElementById("academics").checked;

I did 1 more test, the 'innerhtml'. Firebug reported no error and the 'info' <div> didn't show any results when the 'Show Information' button was clicked.

One more thing, because of browser caching I always use 'Ctrl+F5' 2-3 times to reload a page after making javascript changes. To be sure I'm not working with a cached version.

Posted by: pandy Feb 18 2016, 11:33 AM

Yes, all debuggers require reloading if they weren't open from start.

QUOTE(Christian J @ Feb 18 2016, 02:23 PM) *

If you click e.g. the Toogle Tools option you should see the same thing as me (unless Firebug changes things?).


Looks very similar to Firebug to me. I clicked Console and then JavaScript.

CODE
The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.

The Web Console logging API (console.log, console.info, console.warn, console.error) has been disabled by a script on this page.


That's all I get.

Posted by: pandy Feb 18 2016, 11:37 AM

Wait, it works now. I added a line break in the string and that made it react. I probably had too minor errors to begin, just removed a couple of semi colons.

I'll see if the OP's original code makes it throw errors.

Posted by: pandy Feb 18 2016, 11:58 AM

It does. Both tools, but they report just one error each and a little differently.

Sorry for being a klutz.

Posted by: CharlesEF Feb 18 2016, 12:25 PM

QUOTE(pandy @ Feb 18 2016, 10:58 AM) *

It does. Both tools, but they report just one error each and a little differently.

Sorry for being a klutz.

Glad it works for you now. Don't worry, I have my klutz days also. biggrin.gif

Posted by: CharlesEF Feb 19 2016, 12:56 AM

FYI, according to the Firebug help forum all browsers will automatically create custom properties. They claim none of the debuggers will raise an error when 'innerhtml' is used instead of 'innerHTML' because it is considered a custom property.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)