суббота, 2 февраля 2013 г.

оператор if() jquery

$("body").html("<p>A is larger than B</p>");

The javascript (jQuery) if / else statement is almost identical to the PHP if / else statement.

jQuery syntax is javascript, and therefore a lot of the things you do in jQuery are pretty much the same in plain ol’ javascript. ‘jQuery if statements’ are written the same way as javascript if statements, since it IS javascript.

jQuery is a one of many javascript libraries. Very simply, these libraries are shortcuts created by for people like you and I. You could look at these libraries as one giant javascript plugin which make writing javascript 100 times more simple.

Before I go on, if you’re looking for some pretty useful jQuery tutorials, have a look at

This article exists because when I started out with jQuery, I looked everywhere for a ‘jQuery if / else statement‘. It blew my mind that something as important as an if statement didn’t exist on the web. It took me a while to realize that I couldn’t find it because I was looking in the wrong place. It was because of this giant journey problem I decided to write an article for anyone following a similar path.

They don’t exist. This is because jQuery is javascript. What you’re looking for is a javascript if/else statement.

There is no such thing as a jQuery if / else statement. Shocking, isn’t it? You might be thinking something like: “There must be! In fact, I’m 99% sure there is!“.

Комментариев нет:

Отправить комментарий