Welcome Guest, Not a member yet? Register   Sign In
Jquery not working
#1

[eluser]aum[/eluser]
Hi All,

i am trying to run a code based on jquery but its not running at all
Below is the code
Code:
<head>
    <title>Janko At Warp Speed - Enhance your input fields with simple CSS tricks example</title>
    <style type="text/css">
        body
        {
            font-family: Arial, Sans-Serif;
            font-size: 13px;
        }
    #inputArea
    {
        font-family: Arial, Sans-Serif;
        font-size: 13px;
        background-color: #d6e5f4;
        padding: 10px;
        width:310px;
    }
    #inputArea input, #inputArea textarea
    {
        font-family: Arial, Sans-Serif;
        font-size: 13px;
        margin-bottom: 5px;
        display: block;
        padding: 4px;
        width: 300px;
    }

        .activeField
        {
            background-image: none;
            background-color: #ffffff;
            border: solid 1px #33677F;
        }
        .idle
        {
        border: solid 1px #85b1de;
        background-image: url( 'blue_bg.png' );
        background-repeat: repeat-x;
        background-position: top;
        }
    </style>
    [removed][removed]



    [removed]
        if(jQuery) {
            alert("Loaded");
        }
        $(document).ready(function(){
        $("input, textarea").addClass("idle");
            $("input, textarea").focus(function(){
                $(this).addClass("activeField").removeClass("idle");
        }).blur(function(){
                $(this).removeClass("activeField").addClass("idle");
        });
        });
    [removed]

</head>
<body>
    <h2><a href="www.jankoatwarpspeed.com">Janko At Warp Speed</a></h2>
    <p>This example is from the article <a href="http://www.jankoatwarpspeed.com/post/2008/05/22/CSS-Message-Boxes-for-different-message-types.aspx">Enhance your input fields with simple CSS tricks</a></p>
    <div id="inputArea">
        <label for="txtName">
            Name</label>
        &lt;input id="Text16" type="text" /&gt;
        <label for="txtEmail">
            Email</label>
        &lt;input id="Text17" type="text" /&gt;
        <label for="txtWebsite">
            Website</label>
        &lt;input id="Text18" type="text" /&gt;
        <label for="txtComment">
            Comment</label>
        &lt;textarea id="Textarea6" rows="4" cols="30"&gt;&lt;/textarea></div>
&lt;/body&gt;
&lt;/html&gt;

i just copied it from some working example
http://www.jankoatwarpspeed.com/examples...ut-fields/

but same is not working at my local machine while the alert in script showing that jquery is getting loaded .
can any one help me to find out the error

Regards,
Umesh
#2

[eluser]Ben Edmunds[/eluser]
Do you get any errors in Firebug in Firefox?
#3

[eluser]aum[/eluser]
I tested it using FireBug but it is also not showing any error at all..
#4

[eluser]Ben Edmunds[/eluser]
Do you get anything if you apply the new class to only one element instead of to two, like $('input') instead of $('input, textarea')?

What version of jQuery are you using?

Do you get anything if you do:
Code:
$(function() {alert('test');});
#5

[eluser]aum[/eluser]
Thanks for the reply..
Code:
[removed]
        if(jQuery) {
            alert("Loaded");
        }
        $(document).ready(function(){
        alert("jdfg");
        $("input, textarea").addClass("idle");
            $("input, textarea").focus(function(){
                $(this).addClass("activeField").removeClass("idle");
        }).blur(function(){
                $(this).removeClass("activeField").addClass("idle");
        });
        }); [removed]

alert inside the function is working.

and honestly i don't have much idea about jquery or javascript
regarding Jquery version i amusing this one
jQuery 1.2.6
#6

[eluser]Unknown[/eluser]
As you're using 1.2.6 (current one is 1.3.2), follow the article here http://www.jquerymagic.com/2008/08/getti...th-jquery/ and see if you get the alerts or not.
#7

[eluser]DogWin[/eluser]
Did you load the file "jquery.js".




Theme © iAndrew 2016 - Forum software by © MyBB