Want to add alert if searchTerm length ==0

<script type="text/javascript">

    $(function () {
            // position: { my : "right top", at: "right bottom" },
            source: "home/search",
            minLength: 1,

            autoFocus: true,
            select: function (event, ui) {
                if (ui.item) {
                else { alert("abc")}


I tried several things but somehow i m not able to crack this simple thing. Thanks in advance


How about:

if($.trim($("#searchTerm").val()).length === 0) {

If the .value is a string then..

if (ui.item.value.length == 0)

Need Your Help

Looping and a boolean array?

java arrays loops random

I'm in my first Java programming class ever, and I am currently attempting to write up a user-made method that will loop through a boolean array, give me a random number, check if the array says the

Check to see if string is an integer (includes negative numbers) PHP

php regex integer isinteger

The function below checks if a string is an integer meaning it should only contain digits. But it does not check if number is negative (negative numbers should return true as well since they are