|
The "undefined" shown in the debugger is not a string, so you can't compare it as one.
To really test if your value is undefined, you can use this:
if(typeof document.frmEntry.optMethod != 'undefined')
The typeof operator returns the type of the argument as a string.
|
|
|
|
|
I can't see why use undefined as string - with or without typeof!?
In JavaScript undefined is a value property of the global namespace and yous should use it according to it...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Thank you , this info is enough to solve the issue.
thanks again
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa[at]dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
The typeof for an undefined value is always "undefined". The value undefined being in the global namespace opens up some possible problems:
function madness() {
var a = 'fish', undefined = 'fish';
if(a === undefined) {
}
}
function mistake() {
var a = 'fish';
if(undefined = a) {
}
}
I know these are pretty unlikely scenarios, but better safe than sorry.
In earlier browsers "undefined" was not a testable value so expressions like (a == undefined) would produce the helpful message "undefined is undefined".
|
|
|
|
|
Graham Breach wrote: The typeof for an undefined value is always "undefined".
How that?
var undefined = 'fish';
alert(typeof undefined);
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Yes. If you define undefined as a string variable, then it is no longer undefined and things get confusing.
This is why I was testing the type of the value against the string "undefined" - the string is a constant.
|
|
|
|
|
You can try with remove ("") double quotes OR use ('') single quotes.
modified 9-Sep-14 7:56am.
|
|
|
|
|
I'm reading a tutorial about using selectors in jQuery to modify items on the page. I understand most of it, except I can't figure out why the first line of code below uses a comma to separate the selectors, and the second code line does not. Can anybody tell me when the comma is used and when not?
$('footer, header').slideUp('slow').slideDown('slow');
$('#Sidebar img').fadeTo(5000, 0.1);
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
Thank you.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I'm working on a task where given the coordinates of a line from point A to point B, I need to create a polygonal geofence around(50meters) this line (road route) in google maps.
Can some one help with this?
|
|
|
|
|
|
|
Please, I am using two javascript files, which has its own assigned worked, on a php page, however the jquery script stops working while the JSON2 script works.
This is how I implement both on the php page
<script type="text/javascript" src="jquery.min.js" ></script>
<script type="text/javascript" src="JSON2.js" ></script>
The link to the jquery file http://code.jquery.com/jquery-1.11.1.min.js
The link to JSON2.js :
https://raw.githubusercontent.com/douglascrockford/JSON-js/master/json2.js
**Question**
Please, is it possible to use both script on the same page? if yes, please how to I go about it?
Thanks for helping.
|
|
|
|
|
I'm unaware of any issues using the 2 together. It would help if you could tell us what is happening.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
This is what i see in my web console log
SyntaxError: JSON.parse: unexpected character , this is found in th json.js
TypeError: Q[a].exec is not a function , this is also found in the jquery.js
|
|
|
|
|
Does your code have errors?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi, i think i have solved it,I was previously using json and now i have to changed it to json2
|
|
|
|
|
I have this list of items in a div container, so each item has it's own container. It's a long list of previous orders, a ticket list on the left.
You can click on the container, and the background-color will change, and it will fire a function that accesses a web service, and create a ticket for the item on the right.
LEFT SIDE | RIGHT SIDE
ORDERS | ORDER TICKET PREVIEW
I want to disable the click on the left, the orders, while the ticket on the right is created, so dumb users don't click the thing to death.
I'm not sure how to go about this one, looking for ideas. I wrote it in Javascript, with a little jQuery mixed in.
I was looking for a neat clean way to do this, without globals and chopping it up. I can't see how I can recreate the complex onclick to enable it again, and don't understand what happens to the vars I pass.
Perhaps I can somehow disable the whole container from the click, preserving the underlying click.
So this runs in a for loop, and creates a container for each previous order, with order data inside it.
Hope I was able to convey my thoughts here clearly.
function build COH_List() {
var div_item_container = document.createElement('div');
div_item_container.id = m_ID;
div_item_container.className = 'div_item_container';
div_item_container.style.width = '100%';
div_item_container.style.height = '42px';
div_item_container.style.margin = '3px 0px';
div_item_container.style.borderBottom = "dotted 1px rgb(200,200,200)";
div_item_container.style.display = 'block';
div_item_container.style.cssFloat = 'clear';
div_item_container.onclick = (function (m_ID, m_orderID, m_orderNumber, m_orderDate) { return function () { select_order_click(m_ID, m_orderID, m_orderNumber, m_orderDate); }; })(m_ID, m_orderID, m_orderNumber, m_orderDate);
div_items_container.appendChild(div_item_container);
And then I have a function below that builds the order ticket.
function load_orderDetails() {
}
|
|
|
|
|
have you tried...
element.onclick = '';
maybe write your handler like so.
function load_orderDetails(ele) {
ele.onclick = '';
}
just make sure when you call it you pass it the element that you want disabled. just by chance are you using jQuery because there are message handlers that will do this for you??
|
|
|
|
|
I'll give that that a try later today. Good Idea!
Will let you know the outcome.
|
|
|
|
|
You can use the CSS property pointer-events to disable the click event on any element:
https://developer.mozilla.org/en-US/docs/Web/CSS/pointer-events
// To disable:
document.getElementById('id').style.pointerEvents = 'none';
// To re-enable:
document.getElementById('id').style.pointerEvents = 'auto';
// Use '' if you want to allow CSS rules to set the value
see more here[^]
|
|
|
|
|
Please I am a newbie to Jquery and javascript however I am trying to parse a table name from jquery to a php page which which will be used to truncate a table.
Please below is what I have tried so far...
Jquery page
$(function() {
$.winFocus(function(event, isVisible) {
if(isVisible){
var tableName="table1";
$("#isVisible").val(tableName);
}
else {
var tableName = "table2";
$("#isVisible").val("tableName");
}
});
})
The PHP form
//table name value from jquery
$tableName ='';
// mysql query that truncates the table
$query = "TRUNCATE TABLE $tableName";
This does not give any error,yet it doesnt truncate the table. Please what am I doing wrong?
Thanks for helping.
|
|
|
|
|
If you debug it you should be able to find what's happening.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi...
I am creating web application using Netbeans and Mysql .
I created page to Save, Update & Delete marathi or hindi Language data to my database ... but facing problem with page and database for insert and view data
if i save तुषार ,,,,
database showing me तà¥à¤·à¤¾à¤°
Please help me
|
|
|
|