Jquery:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/timeago.js" ></script>
$(document).ready(function(){
jQuery("abbr.timeago").timeago();
});
html:
<abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>
function Refresh() {
setTimeout(function(){
<?php echo 'var id = '.json_encode($_GET['id']).';'; ?>
$('#cmdz').load('cmdajax.php?id='+id);
},1000);
}
The #cmdz div contains the abbr tag. timeago working properly in onload but when the div is refreshed it won't works.
for some reason jQuery("abbr.timeago").timeago(); function not working. Here you can find full code:after ajax call jquery function not working properly
Try out Livestamp.js. It's unobtrusive and auto-updating. All you need to provide is the Unix timestamp.
Working demo http://jsfiddle.net/FFeE3/1/
Can you please try sourcing your time ago.js from below link and any particular reason you are using jQuery("abbr.timeago").timeago(); you can use $("abbr.timeago").timeago();
Hope this helps rest demo should give you more idea. cheers
Script
<script type='text/javascript' src="https://github.com/petersendidit/jquery-timeago/raw/master/jquery.timeago.js"></script>
code
$("abbr.timeago").timeago();
Two way of representation, Do this way or other way but don't mix:-
jQuery(document).ready(function() {
jQuery("abbr.timeago").timeago();
});
OR
$(document).ready(function() {
$("abbr.timeago").timeago();
});
Related
I have the following code in my header -
<script type="text/javascript">
if ($("#comments").hasClass("comments-list")) {
javascript:document.getElementById('g-aside').style.width='0px';
javascript:document.getElementById('g-aside').style.marginleft='100%';
javascript:document.getElementById('g-aside').style.visibility='hidden';
javascript:document.getElementById('g-main').style.width='100%';
}
</script>
It does not work for some reason... The following page is the one i am attempting to adjust.
http://luogocomune.net/LC/index.php/20-varie/4290-benvenuti-sul-nuovo-sito
First of all, include the jQuery library before this script block of yours.
Then, change your script block to:
<script type="text/javascript">
$(document).ready(function(){
if ($("#comments").hasClass("comments-list")) {
$('#g-aside').css('width','0px')
.css('margin-left','100%')
.css('visibility','hidden');
$('#g-main').css('width','100%');
}
});
</script>
Readup: http://api.jquery.com/css/
Good day!
I have recently acquired a code and was passed on using fiddle. It works fine on the fiddle but when I am trying to implement it on my site.
Head tag contains:
<head>
<title>NQA Insert</title>
<script type="text/javascript" src="NQAa.js">
</script>
</head>
While NQA.js contains:
$('#bill50').on('change', function() {
var date30 = new Date($(this).val());
date30.setDate(date30.getDate()+30);
var date20 = new Date($(this).val());
date20.setDate(date20.getDate()+60);
$('#bill30').val(date30.toJSON().slice(0,10));
$('#bill20').val(date20.toJSON().slice(0,10));
});
Note 1: If you input a date on bill50, the value on bill30 and bill20 also changes.
Note 2: I am implementing this on a php page. Maybe this helps...
Why is it that when implementing it on the site, it doesn't work at all? Is there anything wrong in my calling of the jscript..?
you need to include the jQuery library, as you can see in your jsFiddle he's including jQuery 1.8.3, you should add it in your "head" tag just before the js script you bought.
You'll get something like this:
<head>
<title>NQA Insert</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js">
<script type="text/javascript" src="NQAa.js">
</script>
</head>
my code is
<script src="~/Scripts/jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
alert("hello");
});
</script>
How to make to work the Jquery. Thanks.
update: "Hello" msg is not shown. Thanks.
The ~ symbol can represent the root of the website only when it is executed in the server. Use the following to replace the script include:
<script src="#Url.Content("~/Scripts/jquery-1.8.0.min.js")"></script>
Hope this would help you!
I'd be checking the path you have. The ~/ is parsed on ASP.NET server side controls, but not on normal HTML tags entered into a page. I think you want something like the following.
Traditional ASP.NET
<script src="<%=ResolveUrl("~/Scripts/jquery-1.8.0.min.js")%>"></script>
ASP.NET MVC Razor
<script src="#Url.Content("~/Scripts/jquery-1.8.0.min.js")"></script>
Try using jquery script from CDN
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
Otherwise your code is okay
working demo
Try this may this work for you
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
I want a tooltip to show when I rollover on particular links. It's not working. The commented out alert is working, so event is not the issue. This is my javascript code:
$(window).load( function() {
$("a").each(function() {
if(this.text==" View image") {
$(this).mouseover(function() {
// alert("blabla");
$(this).tooltip();
});
}
});
});
on my html file the includes are:
<script type="text/javascript" language="javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript" language="javascript" src="jquery.tooltip.min.js"></script>
<script type="text/javascript" language="javascript" src="mainscript.js"></script>
I'd appreciate some help.
UPDATE: removing mouseover doesn't help
Remove the mouseover function. The plugin doesn't require you to add a custom mouseover function. It's done from the plugin for you.
if(this.text==" View image") {
$(this).tooltip();
}
Hope this helps ^^
Change the main jQuery function to $(document).ready(function(){});
This will probably work now~
Try this:
$("a").each(function() {
if(this.innerHTML == " View image") {
$(this).tooltip();
}
}
Also, there's a space before the View in "View image". I'm not sure if that's intentional or not.
I used jQuery tipsy on my recent projects. Quite easy to understand and integrate.
I am using thick box 3.1 to load a pop up. It working well by using in the following way:
TEST
If we click on the TEST now then the popup is working well and good.
Now my prob is: I need to call this popup in form load using JavaScript.
I do something like below:
<script type="text/javascript">
window.location.href = "filename.php"
</script>
it's just redirecting to that particular file. But not showing in the pop up.
What is the possible way?
thanks in advance
Try this:
Test
<script type="text/javascript">
$(function(){ // On DOM ready
$('#openOnLoad').click();
});
</script>
You can do this without changing your markup, like this:
$(function() {
$('a[href=filename.php]').click();
});
TEST
<script type="text/javascript">
$("#UniqueIdForThisLink").click();
</script>