simple javascript not working

Here's the code involved:

          <script language="javascript">
               function sms() {
                   alert("at sms");  /*this alert does NOT work*/
               }
          </script>

         <input type="checkbox" onclick="alert('at sms call'); sms();" /> <!-- when box is clicked, this alert works...-->

Any assistance will be most appreciated. This is driving me nuts! :-)

Thanks much,
softexecware
Jerry KrogerCTO - FounderAsked:
Who is Participating?
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
         <script>
               function sms() {
                  alert('at sms call');
                   alert("at sms");  /*this alert does NOT work*/
               }
          </script>

</head>
<body>
    <input type="checkbox" onclick="sms();" />
</body>
</html>

Open in new window


http://jsbin.com/joleridito/1/edit
0
 
Trenton KnewOwner / Computer WhispererCommented:
why are you calling the function and the function's function at the same time?  

What is it exactly this function is supposed to do?

What is returned when you click the button?  "at sms call" or "at sms"?
0
 
Jerry KrogerCTO - FounderAuthor Commented:
There are other things that will be added to the function, after it starts to fire.
"at sms call" is returned when the checkbox is clicked.
Then it should fire the function sms(), but that is not happening - and that's the issue
0
 
Trenton KnewOwner / Computer WhispererCommented:
This appears to work fine...
 <script language="javascript">
               function sms() {
                   alert("at sms");  /*this alert does NOT work*/
               }
          </script>

<input type="checkbox" onclick="sms();" /> <!-- when box is clicked, this alert works...-->

Open in new window

0
 
Jerry KrogerCTO - FounderAuthor Commented:
Thanks to each expert!
Both solutions worked.
...and forced the cache to update than my original code started working.
I have changed my settings to check for new versions every time a page loads.
Thanks again,
Jerry
Jerry@softexecare.com
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.