0

Now i have a requirement in jquery. But my jsp page not loading the jquery code. I am not able to address the issue.hereby i will give my code. can any one give suggestion on this?

My jsp is,

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

    <link rel="StyleSheet" href="/css/stylesheets.css" type="text/css">
    <link rel="StyleSheet" href="/css/jquery_tzineClock.css" type="text/css">
    <script language="Javascript" src="/js/X2AUtils.js"> </script>
    <script language="Javascript" src="/js/jquery-1.3.2-vsdoc2.js"> </script>
    <script language="Javascript" src="/js/jquery_tzineClock.js"> </script>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script language="Javascript" src="/js/counter.js"> </script>
    <script language="javascript">  

    </script>
</head>
<base target="_self">
<title></title>
<body>
<table width="1002" border="0" cellspacing="0" cellpadding="0" class="landingHdrBg" valign="top">
    <tr>    
        <table border="0" cellspacing="0" cellpadding="0" width="98%">
                <tr>
                    <td valign="bottom" >
                        <table width="60%" border="0" cellspacing="0" cellpadding="0" align = "right">
                        <tr>
                            <div id="fancyClock" > </div>
                             <p> sfgsdgsdgf</p>                                                 
                         </tr>

                        </table>
                     </td>
                   </tr>                               
        </table></td>
    </tr>
</table>
</body>
</html>

And my counter.js is,

$(document).ready(function(){
    /* This code is executed after the DOM has been completely loaded */
    alert('On ready function');
    $("p").text = "testing.... ";
});

Here the alert is coming. but the para text is not changing . i downloaed various jquery.js and tried.

1
  • Triple nested invalid layout tables? Oh dear. Commented Nov 29, 2011 at 9:25

2 Answers 2

1

you need to have

$("p").html("testing....");

OR
$("p").text("testing....");

.text() should be a function that gets only the text without HTML tags. More information about text http://api.jquery.com/text/

Small fiddle: http://jsfiddle.net/gSc4z/

Sign up to request clarification or add additional context in comments.

2 Comments

i tried with, html also it results same. i am using jsp page. Is any thing need to import?
$(document).ready(function(){ $('#fancyClock').tzineClock(); });
1

If you're seeing the alert, then jQuery is loading fine.

The problem is your code changing the paragarph: You're setting a property called text, but text is a function, so you call it instead:

$("p").text("testing.... ");

Note that that line will change the text of all paragraphs to "testing.... ". Granted there's only one p element in your quoted markup, but presumably there will be more at some point...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.