if (pathname == "/" || pathname == "/default.asp")
in js using jquery library.
I want this to catch "Default.asp" as well as "DeFaULT.asp" and "default.asp"
halp.
Hello
I'm showing a hidden box with jQuery on link-click. Now the box disappears when clicking the link again, but how to make it so it kinda "loses focus" and hides. SO, when user click somewhere on document (but not the box itself), it disappears.
Suggestions?
Martti Laine
I need this video to play automatically. It would be nice, this code can play videos from other sources like yahoo etc.. Is it also possible to use HTML5, instead of jquery?
Here's my situation:
I'm writing an ASP.net MVC 1 website and I have a create/edit form that uses the default model binding to parse the form into a strongly typed complex object.
The object I'm posting has a child collection of another complex type and the way I format my id's for the model binder is as follows:
<div class="childContainer" >
<!-- There's one of these for each property for each child collection item -->
<%= Html.TextBox("ChildCollectionName[0].ChildPropertyName", /* blah blah */ ) %>
<%= Html.TextBox("ChildCollectionName[0].OtherChildPropertyName", /* blah blah */ ) %>
<!-- ... -->
</div>
This gets rendered as
<div class="childContainer" >
<input id="ChildCollectionName[0]_ChildPropertyName" ... />
<input id="ChildCollectionName[0]_OtherChildPropertyName" ... />
...
</div>
<div class="childContainer" >
<input id="ChildCollectionName[1]_ChildPropertyName" ... />
<input id="ChildCollectionName[1]_OtherChildPropertyName" ... />
...
</div>
For each entry in the chlid collection.
This collection is dynamically created in the form using jQuery, so entries can be added, removed etc. and whenever there's an operation on the collection I need to update the indexes so that it's bound correctly on the server side.
What's the best way to replace all the html input id's when I'm updating the index within the child e.g.
replace all [*] -- [N] where N is the correct index.
using jQuery / JavaScript ?
I have something coded now, but its buggy and I think there is a simpler solution.
Also, if you have an easier way to identify the child collection I'll take any advice on that as well.
Thanx!
What I have to work with:
An html table 5X7. On many queries, there are less that 35 items filling the complete table.
How can I "hide" the empty cells dynamically in this case, using jQuery (or any other efficient way)?
Thank you.
Consider i have an anchor which looks like this
<a href="~/Resumes/Resumes1271354404687.docx">
~/Resumes/Resumes1271354404687.docx
</a>
I want to get either href/text in jquery onclick of that anchor ...
I'm unable to get this script to work as an extension in google chrome. No alert shows up. normal javascript alerts work.
// ==UserScript==
// @name voip
// @namespace 1
// @description voip
// @include *
// @require http://jquery.com/src/jquery-latest.js
// ==/UserScript==
$(document).ready(function() {
alert("Hello world!");
});
hi,
I'm using jQuery Media module in Drupal to use my own flv player. It works great, however I would like to assign different width and height size according to the videos sizes.
How can I do it ? Should i pass back values from Flash app with an External Call ?
thanks
Whenever I load ONLY the 1.3 or 1.4 library on an html page im developing on my desktop I get an error that says "setting a property that only has a getter"
I dont have any additonal code, this is coming straight from the jquery.min.js file
I also get a bazillion warnings in Firebug.
Can someone help me resolve this issue?
I can't determine why this is happening
jQuery 1.4.2's animate() API spec is
.animate( properties, [ duration ], [ easing ], [ callback ] )
but it seems that we can supply duration, callback, and no easing
.animate({left: '+= 100'}, 600, doThis)
and it will work.
But if we supply easing and callback and no duration
.animate({left: '+=100'}, 'swing', doThis)
then the easing won't be taken into effect. So what exactly is the API supposed to be?
I want to make my component faster, I am using Javascript and JQuery to build that.
I am using JSON object to communicate with component and back-end is python.
Is there any suggestion to make component faster?
Consider a hiddenfield in the page HfId
<input type="hidden" id="HfId"/>
How to assign,clear and get value of a hidden field in jquery? ANy suggestion...
I have a string in my db I want to pull into my page and convert to a json object.
[
{id: 1,title: "Long Event",
start: new Date(2009, 5, 6, 14, 0),end: new Date(2009, 5, 11)},
{id: 2,title: "Repeating Event",
start: new Date(2009, 5, 2)},
{id: 3,title: "Meeting",
start: new Date(2009, 5, 20, 9, 0)},
{id: 4,title: "Click for Facebook",
start: new Date(2009, 5, 27, 16),end: new Date(2009, 5, 29),
url: "http://facebook.com/"}
]
How can I do this using JQuery?
In our project we use plugin for jQuery - Galleriffic (http://www.twospy.com/galleriffic/), it allows you to do slideshow with photo set.
How to hide buttons prev/next in "pagination" block?
In the navigation ("pagination" block) should be only the page numbers without buttons prev/next.
Is there a way using jQuery or Javascript to force a page to open in Firefox? For example, if the user has their default browser set to internet explorer, but they have firefox on their computer - open a new firefox window with the intended page. If so, I would need to check to see if they have firefox on their machine; otherwise, redirect to the mozilla firefox download site...
any suggestions?
I'm unable to get this script to work as an extension in google chrome. No alert shows up. normal javascript alerts work.
// ==UserScript==
// @name voip
// @namespace 1
// @description voip
// @include *
// @require http://jquery.com/src/jquery-latest.js
// ==/UserScript==
$(document).ready(function() {
alert("Hello world!");
});
This is my first time building a tool like this, so please bare with me. I'm doing this to learn more about jQuery and AJAX.
Basically, I have a search input and a hidden div. When you start typing in the search input, the hidden div becomes visible and results are brought in. In this case, I'm searching for client names.
It all works fine, however I think my code could be better but I'm not sure exactly where to begin. Each keyup requests a PHP script which accesses a table in a database to find a like string. But in my PHP script, I'm echo'ing some JS/jQuery which I'm not sure is good practice. Below is my code. Am I going about this the right way or am I totally off base? Any suggestions for improvement?
Javascript
$("#search").keyup(function() {
$("#search_results").show("fast");
$.ajax
({
type: "POST",
url: "http://localhost:8888/index.php/welcome/search/" + $("#search").val(),
success: function(html)
{
$("#search_results").html(html);
}
});
});
PHP
function search($search_string = false)
{
if ($search_string)
{
$this->db->like('name', $search_string);
$query = $this->db->get('clients');
if ($query->num_rows() == 0)
{
echo "No client exists.";
}
else
{
foreach ($query->result() as $row)
{
echo '<script>';
echo '
$("#client_results_'.$row->id.'").hide();
$("#'.$row->id.'").toggle(function()
{
$.ajax
({
type: "POST",
url: "http://localhost:8888/index.php/welcome/search_client_ads/" + '.$row->id.',
success: function(html)
{
$("#client_results_'.$row->id.'").html(html).show("fast");
}
});
}, function()
{
$("#client_results_'.$row->id.'").hide("fast").html("");
});';
echo '</script>';
echo '<p><span id="'.$row->id.'">'.$row->name.'</span></p>';
echo '<div id="client_results_'.$row->id.'"></div>';
}
}
}
else
{
echo '';
}
}
function search_client_ads($client_id)
{
$query = $this->db->get_where('online_ads', array('client' => $client_id));
if ($query->num_rows() == 0)
{
echo "No ads exist.";
}
else
{
foreach ($query->result() as $row)
{
echo $row->id;
}
}
}
While John Resig's recommendation is, quite rightly, to declare all events within a jquery.document.ready() function, I know that you don't actually have to put everything in there. In fact, there are cases where it may be more appropriate to deliberately put methods outside of the ready event.
But what are those cases? Obviously best practice dictates that all events are declared within the ready event, so what would best practice be for declarations outside that event?
I have to copy repeatedly data (contact info such as name, surname, telephone...) from form A (page 1 in domain x.com) to form B (page 2 in domain y.com)
I have been thinking about creating a chrome extension with the help of jquery to copy the data from form A, and inject it form B...
I have a feeling that this is not the best way to solve this problem...
What do you think is the best way to copy and paste data from pages in different domains?
Hi,
All I have a Span in side the Form view. I wanted to Call a Jquery Fucntion when the from load how can i do this?
Thanks
Waiting for your reply
here is my code
<asp:FormView ID="FormView1" runat="server" OnItemCommand="FormView1_ItemCommand">
<ItemTemplate>
<asp:HiddenField ID="hidProductID" Value='<%#Eval("ProductID") %>' runat="server" />
<asp:HiddenField ID="hidCustomerID" Value='<%#Eval("CustomerID") %>' runat="server" />
<a href='<%=WinToSave.SettingsConstants.SiteURL%>WintoSave/AuctionProduct.aspx?id=<%#Eval("ProductID") %>'>
<%#Eval("ProductName")%>
</a>
<br />
<img src='<%#Eval("ImagePath")%>' alt="Image No available" />
<br />
<asp:Label ID="lblTime" runat="server" Text='<%#Convert.ToDateTime(Eval("ModifiedOn")).ToString("hh:mm:ss") %>'></asp:Label>
<span id='Countdown_<%#Eval("ProductID") %>' onload="GetTimeOnLoad('<%#Eval("ModifiedOn")%>','Countdown_<%#Eval("ProductID") %>');"></span>
<br />
<asp:Label ID="lblFinalPrice" runat="server" Text='<%#Convert.ToDouble(Eval("FinalPrice")).ToString("#.00")%>'></asp:Label>
<br />
<asp:Label ID="lblFullName" runat="server" Text='<%#Eval("FullName") %>'></asp:Label>
<br />
<asp:Button ID="btnAddbid" Text="Bid" CommandName="AddBid" CommandArgument='<%#Eval("ID")%>'
runat="server" />
</ItemTemplate>
</asp:FormView>
and following is my jquery code
function GetTimeOnLoad(shortly,DivID)
{
var dt = new Date(shortly);
alert(dt);
alert(shortly);
alert(DivID);
var ProductDivID = "#" +DivID;
alert(ProductDivID);
$(ProductDivID).countdown({
until: dt, onExpiry: liftOff, onTick: watchCountdown,
format: 'HMS', layout: '{hnn}{sep}{mnn}{sep}{snn}'
});
}
function liftOff(){};
function watchCountdown(){};
In above code I Used
' onload="GetTimeOnLoad('<%#Eval("ModifiedOn")%','Countdown_<%#Eval("ProductID") %');"
but is not working
In jQuery//dialog you can make a button like this:
dialog({ buttons: { "Ok": function() { $(this).dialog("close"); } } });
Can I make this button with a hyperlink to somewhere instead?
I write a test android app, in which there are only two views, a chronometer and a imageview. Using the layout() method of the imageview to dynamically change the position of it, I wish to implement drag-and-drop effect. It does work.
However, each time the chronometer ticks, the imageview is always reverted to its original position, which seems that the whole screen is reloaded from the layout xml.
So, does anybody know how to prevent the imageview from reverting to the original place, and let chronometer and drag-and-drop effect coexist? Thx
I'm trying to load one page into another using the .load() method. This loaded page contains a script that I want to execute when it has finished loading. I've put together a barebones example to demonstrate:
Index.html:
<html>
<head>
<title>Jquery Test</title>
<script type="text/javascript" src="script/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#nav a').click(function()
{
$('#contentHolder').load('content.html #toLoad', '', function() {});
return false;
});
});
</script>
</head>
<body>
<div id="nav">
<a href="content.html">Click me!</a>
</div>
<hr />
<div id="contentHolder">
Content loaded will go here
</div>
</body>
</html>
Content.html:
<div id="toLoad">
This content is from content.html
<div id="contentDiv">
This should fade away.
</div>
<script type="text/javascript">
$('#contentDiv').fadeOut('slow', function() {} );
</script>
</div>
When the link is clicked, the content should load and the second paragraph should fade away. However it doesn't execute. If I stick a simple alert("") in the script of content.html it doesn't execute either.
However, if I do away with the #toLoad selector in the .load() call, it works fine. I am not sure why this is, as the block is clearly in the scope of the #toLoad div. I don't want to avoid using the selector, as in reality the content.html will be a full HTML page, and I'll only want a select part out of it.
Any ideas? If the script from content.html was in the .load() callback, it works fine, however I obviously don't want that logic contained within index.html.
I could possibly have the callback use .getScript() to load "content.html.js" afterwards and have the logic in there, that seems to work? I'd prefer to keep the script in content.html, if possible, so that it executes fine when loaded normally too. In fact, I might do this anyway, but I would like to know why the above doesn't work.