Note that there are some explanatory texts on larger screens.

plurals
  1. POUncaught TypeError: Cannot read property 'sms' of undefined
    text
    copied!<p>I am trying write code for sending sms in phonegap.I have written the code.But I am getting the error:Uncaught TypeError: Cannot read property 'sms' of undefined.Following is my code. Please advise.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta name="viewport" content= "width=device-width; height=device-height; user-scalable=no"&gt; &lt;link rel="stylesheet" type="text/css" href= "jquery.mobile-1.0b3.min.css"&gt; &lt;script src="jquery-1.6.min.js" type= "text/javascript"&gt;&lt;/script&gt; &lt;script src="jquery.mobile-1.0b3.min.js" type="text/javascript"&gt; &lt;/script&gt; &lt;script src="cordova-2.3.0.js" type="text/javascript"&gt; &lt;/script&gt; &lt;Script src="smsplugin.js" type="text/javascript" &gt;&lt;/script&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;script type="text/javascript"&gt; //document.addEventListener("deviceready", onDeviceReady, false); //function onDeviceReady () { function Message() { alert("hi"); alert('Phone: ' + $('#phone').val() + ' Message: ' + $('#message').val()); window.plugins.sms.send($('#phone').val(), $('#message').val(), function () { alert('Message sent successfully'); }, function (e) { alert('Message Failed:' + e); } ); } &lt;/script&gt; &lt;body&gt; &lt;div id="startPage" data-role="page" data-theme="a"&gt; &lt;a href="home.html" data-role="button" data-transition="turn" data-inline="true" data-icon="back"&gt;Back&lt;/a&gt; &lt;div data-role="header"&gt; &lt;h1&gt;SMS Demo&lt;/h1&gt; &lt;/div&gt; &lt;div data-role="content"&gt; &lt;label for="phone"&gt;Recipient Number:&lt;/label&gt; &lt;input type="tel" id="phone" name="phone" placeholder="SMS Number"/&gt; &lt;label for="message"&gt;Message:&lt;/label&gt; &lt;textarea id="message" name="message" placeholder="Type your text message here...........(Eg- Hi Dad, I am in an emergency...please help me.I am located at (GPS Location))"&gt;&lt;/textarea&gt; &lt;!--&lt;a href="#" id="sms" data-role="button" onclick="Message()"&gt;Send&lt;/a&gt;&lt;/br&gt;--&gt; &lt;button id= "sendbutton" onClick="Message()"&gt;Send&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload