Hi,
what is the right way to determine if an object has one class OR another one?
The following is appearantly wrong..
if ($('#menu-item-49').hasClass('current-menu-item' || 'current-menu-parent') ) {
$('ul.sub-menu ').css('display', 'block');
}
Thanks!
...
So, why does this work:
<?php if (condition): ?>
<!--html code here-->
<?php endif; ?>
But not simply this:
<?php
if (condition) { ?>
<!--html code here-->
<?
}
I figured it was just style preference, but I actually can't seem to get it to work the second way. Am I just doing something completely wrong? I can't see the ...
I have a query which returns 3 fields, one of which is the month as a two digit number.
I want to basically have it so if month == 1 output january, if month == 02 output febuary etc
This is what I am trying, but this does not work at all, and prevent the entire column from being displayed in PHP.
while ($row = mysql_fetch...
Hello,
i try to copy the second line from a txt, that works great problem is now i try to make an if-statement that check the txt, is there something in line 2.
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile("testfile.txt", True)
MyFile.WriteLine("" + LastMessage + "")
MyFile.Close
rownumber...
if (select * from table where x=1) returns 0 rows then i need (select * from table where x=2 [or some other query]). is it possible to do this in a single MYSQL query with a conditional statement?
edit: all answers with 'UNION' work but only if both queries selects from the same table (or tables with the same number of columns). What if...
Hello all.
I shall attempt to explain the scenario.
I have a gridview I wish to amend according to the preferences a user may set. These preferences being stored within a table in a EDMX (tblPref). The table gives the prefernce i.e. Product, the Alias for the preference i.e. SKU and whether the Preference should be shown i.e. ShowProdu...
Hi, I am stuck in a Clojure loop and need help to get out.
I first want to define a vector
(def lawl [1 2 3 4 5])
I do
(get lawl 0)
And get "1" in return. Now, I want a loop that get each number in the vector, so I do:
(loop [i 0]
(if (< i (count lawl))
(get lawl i)
(recur (inc i))))
In my mind this is supposed...
I am writing some jQuery code that involves jumping from several functions. In one function, an 'if'-statement is used to select where the code will go next. The condition for the if statement is the value of a variable that was passed from the previous function. So, to clarify, a function passes a variable to another function, which the...
I am trying to make a timestamp function that checks which displays a time if it has been less than 24 hours and a date if it has been more. If anybody knows of a prebuilt way to do this please let me know.
Anyways, I've started with this simple php which is suppose to return a number less than 86400 if $temprow1 or 2 are less than 8640...
Ever since reading Clean Code I have been trying to keep my code descriptive and easy to understand. I have a condition where either A or B must be filled in. But not both. And not neither. Currently the if statement to check for this condition is hard to follow at a glance. How would you write the following to make it clear at a gl...
I wish to do something like this:
DECLARE @IgnoreNulls = 1;
SELECT Col1, Col2
FROM tblSimpleTable
IF @IgnoreNulls
BEGIN
WHERE Col2 IS NOT NULL
END
ORDER BY Col1 DESC;
The idea is to, in a very PHP/ASP.NET-ish kinda way, only filter NULLs if the user wishes to. Is this possible in T-SQL? Or do we need one large IF block like so:
IF...
What I want to accomplish is simple. I want a button's text to change depending on what page your on.
I start this by using the following:
var loc_array = document.location.href.split('/');
Now that I have the url and split it in an array I can grab certain directories depending on the position, like so:
if (loc_array[loc_array.leng...
I'm having a very hard time trying to do something very simple. Here's the code:
if(data == 'success') {
alert('foo');
} else {
alert(data);
}
I've simplified it, but that's all that's necessary to understand what's going on. the variable 'data' is a result of an AJAX call, if that m...
I saw this in code. It blew my mind.
<% if (false) { %>
<script type="text/javascript" src="~/Scripts/jquery-1.3.2.js"></script>
<% } %>
This seems so patently illogical that it must be intentional. I can only assume that somehow this "came up", and somebody inserted this as a work-around. There are, of course, no comments.
Why ...
I'm stumped on this and my searches aren't turning up anything relevant.. I need to do a while loop that will continue if either of 2 variables are true... as far as I can tell you can't do a "while ($var = '' and $var2 = ''); so I tried this, basically I figured I could just set 2 different if statements so that it would change the vari...
I am new to .net completely and I just need to know the syntax, or possible functions to put in my if statement to check if <% If Model.contacts Is Null Then%> which isn't correct.
Where Model.contacts comes from my ClientViewModel, and Model.contacts is of type System.Linq.IQueryable(Of Contact)
Here is the code for addresses...
<% ...
I have statements such as @user = User.find(current_user.id) throughout my app.
Sometimes a user might enter with a nil variable (such as a new user for whom current_user is nil).
I'm sure the dumb way to do this would be to scatter if statements everywhere like...
if current_user.exists?
@user = User.find(current_user.id)
else
re...
Hi whenever i run the code below it occurs to me I have made a mistake using the if exist lines, as no matter whether the directory exists or not, it acts as if the line was never there... either that or its not reading the else line.
echo off
echo
echo (c) Ryan Leach 2010
echo Stockmaster Backup System for exclusive use of Rive...
My aim is to take two strings and compare there ends if both of them ends with "ing","ed" or there ends do not match.It always says that strings do not match .
#include <stdio.h>
#include <conio.h>
#include <string.h>
int ised(char str[]);
int ising(char str[]);
int main()
{
char str1[30],str2[30];
printf("Enter 1st string:\n"...
How can i split cases for None and False in django templates.
{%if x %}
True
{%else%}
None and False - how i can split this cases?
{%endif%}
...