$('.testimonials blockquote p')
.prepend('“')
.append('”');
...prepends and appends TWICE. How do I prepend ldquo + whatever content inside the p + rdquo?
Thanks!
the html
<div class="stackwrapper" id="user1"></div>
<div class="stackwrapper" id="user2"></div>
<div class="userdrawings"></div>
the javascript
$('.stackwrapper').click(function(e){
var id=$(this).attr('id');
$('.userdrawings').load('loadSession.php?user='+id).fadeIn("slow");
});
Somehow it only works at once, only at the first click on stackwrapper, when I click on the second one, the function is not triggered again.
I have a page with several galleries including accordions and sliders. The problem is that the page takes forever to load. Is there a way of wrapping an image in a bit of code or applying a class to it to force it to load only after everything else is loaded?
<script type="text/javascript">
$(document).ready(function() {
$('#tmpOpen').click(function() {
var value = $("#tmpOpen").attr("value");
if (value == "Expand") {
document.getElementById("tmpOpen").value = "Collapse";
$('#Grid tr[role="row"] td a').not('.icon-minus').click();
}
else {
document.getElementById("tmpOpen").value = "Expand";
$('#Grid tr[role="row"] td a').not('.icon-plus').click();
}
});
</script>
is this right what i am doign here? icon-plus is class name for a...
i want move up the object, delay 1000ms , then hide it,
i get the code:
$("#test").animate({"top":"-=80px"},1500)
.animate({"top":"-=0px"},1000)
.animate({"opacity":"0"},500);
i use ".animate({"top":"-=0px"},1000)" to implement delay, it's not good.
i want:
$("#test").animate({"top":"-=80px"},1500)
.sleep(1000)
.animate({"opacity":"0"},500);
any idea? thanks! :)
I need a little piece of advice.
I have a test page with 2 fields: word number and URL
Also i have a button Push.
When i push the button i want to open the specified URL (it's local html files) and highlight the word at the "word number" position
Of course the code must ignore element nodes (<p>,<b>,<table> and so on)
I've been wrestling with this problem for a couple hours now.
Essentially, what I need to do is take the following or similar HTML:
<div id="excpdivs">
<div class="excpdiv" id="excpdiv0">
Date: <input name="excp[0][date]">
Open: <input name="excp[0][open]">
Close: <input name="excp[0][close]">
</div>
<div class="excpdiv" id="expdiv1">
Date: <input name="excp[1][date]">
Open: <input name="excp[1][open]">
Close: <input name="excp[1][close]">
</div>
and get an array similar to the following to a php script:
Array
(
[0] => Array
(
[date] => 2012-09-15
[open] => 3:00
[close] => 5:00
)
[1] => Array
(
[date] => 2012-09-16
[open] => 2:00
[close] => 5:00
)
)
My main problem is getting the values from the input elements. My latest attempt is the following:
var results = [];
$(".excpdiv").each(function(){
var item = {};
var inpts = $(this).find("input");
item.date = $(inpts.get(0)).val();
item.open = $(inpts.get(1)).val();
item.close = $(inpts.get(2)).val();
results.push(item);
});
Am I on the right track or am I hopelessly lost?
To empty a div and replace it with an image I am using:
$(this).html('');
$('<img/>', {
src: 'blah.gif'
}).appendTo(this);
Is there a better way to do this?
hi,
i have a proj where on change of select box i am loading data from server. how do i make sure that until the data is loaded user cant do anything else on the page ..
Through JavaScript I am appending one query parameter to the page url and I am facing one strange behaiviour.
<div>
<a href="Default3.aspx?id=2">Click me</a>
</div>
$(function () {
window.location.href = window.location.href + "&q=" + "aa";
});
Now I am appending &q=aa in default3.aspx and in this page the &q=aa is getting added continuously, causing the URL to become:
http://localhost:1112/WebSite2/Default3.aspx?id=2&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa&q=aa
One would say just pass it like <a href="Default3.aspx?id=2&q=aa">Click me</a>, but I cant do that. The value of this query parameter is actually the value of an HTML element which is in default3.aspx. I have to add it in runtime.
What are the ways to achieve this?
$('#customerAddress').text().replace(/\xA0/,"").replace(/\s+/," ");
Going after the value in a span (id=customerAddress) and I'd like to reduce all sections of whitespace to a single whitespace. The /\s+/ whould work except this app gets some character 160's between street address and state/zip
What is a better way to write this? this does not currently work.
i'm building a page, which will have categories that will contain a list of pages to go with them. at first all the list are hidden, and than I click on a category and the list slides down. this is the code of the script:
$(document).ready(function() {
$('.menu-list').hide();
$('.menu-title').click(function() {
if ($(this).next().is(':not(:visible)')) {
$('.menu-list:visible').slideUp();
$(this).next().slideDown();
}
});
The script works, but the problem is when I'm clicking on a category in a column that has more categories than the other. than the last category is moving to the left and I don't want it to. Here is the code in jsfiddle: http://jsfiddle.net/U7rKX/4/
Can you help me?
I have a table of names and ages that I want the user to be able to sort. When the page initally loads, sortList lists the rows in order from oldest to youngest, and then secondarily from A to Z.
I want the same thing (a SECONDARY alphabetical sort) when the user actually clicks on the age <th>, but sortForce is making the alphabetical sort primary. Is there an alternative?
$('#super_results table').tablesorter({
sortForce: [[0,0]],
sortList: [[1,1],[0,0]]
});
Or am I misunderstanding sortForce? Documentation here.
Hi guys, I have an HTML form consisting of some text-inputs. I'm using jqTransform to prettify them. Now I want to add two buttons that will add and remove text-input dynamically.
Adding is easy:
$('#container').append('');
$('input[name=foo]:last-child').jqTransInputText();
But removing is tricky:
$('WHAT-TO-SELECT').remove();
I can't do "input[name=foo]:last-child" since it's already wrapped (some divs) by jqTransform. To put this question in another way: How do I select based on "who has child of type input with 'foo' as its name"?
I need a function that accepts a parameter with its id example a div
and after that loops inside the div to look for checkboxes and if there is/are any checks if its value is checked and returns true if every checkbox is checked returns false.
As I've come to understand using $('.whatever').click() only works for items created initially. Additional items won't respond in the correct fashion. I was then directed to using something like $('.whatever).on('click', myFunction()). However, I'm not detecting any difference, as newly created items are not called.
Here is a JSFiddle demonstration my example code: http://jsfiddle.net/atrus6/zaKZN/
My initial input plus 'Kill' will work in the correct fashion, however any additional 'input + kill's will not not do anything. Am I incorrectly using .on() or is it something else?
there are 2 multiple select list on my page , one is there with a seperate remove button . selecting an item there in the selected list is removing the item from the first select list also.how will i specify which list to remove item from in this code
$().ready(function() {
$('#remove').click(function() {
return !$('#FeatureList option:selected').remove();
});
});
How to submit default data when using $.ajax?
I have tried:
$.ajaxPrefilter(function(options, originalOptions, jqXHR) {
// can't access anything here... (tried jqXHR.data but undefined)
});
$.ajaxSetup({
beforeSend: function(jqXHR, settings) {
// can't access anything here... (tried jqXHR.data but undefined)
}
});
I need this so I can send my CSRF token, each time and when logged in submit the user ID each time. I prefer not to submit a token in headers.
Thanks
I want a function that replace each li with an image. This is my code:
$(document).ready(function(){
var tmphref;
var tmpname;
var str = '<a href="' + tmphref + '"><img src="http://www.somesite.com/a/' + tmpname[1] + '/avatar-small.jpg /></a>';
$('#somediv li a').each(function(){
tmphref = $(this).attr("href");
tmpname = /http\:\/\/(\w+)\.somesite\.com\//.exec(tmphref);
$(this).parent().replaceWith(str);
});
});
The image is in this specific path: www.somesite.com/a/username/avatar-small.jpg
The code above doesn't work. Any ideas?
Thank you in advance.
I want to switch images on .click() using the url attr I can do so, but I can't figure out how to make it wait, until the animation is done to redirect to the new webpage.
Here's the js
$(function() {
$('.cv').click(function(){
$("#cv img").fadeOut(2000, function() {
$(this).load(function() { $(this).fadeIn(); });
$(this).attr("src", "images/cv2.png");
return true;
});
});
});
Here's the html:
<div id="cv" class="img one-third column">
<a class="cv" target="#" href="cv.joanlascano.com.ar">
<img src="images/cv1.png" alt="Curriculum"/>
<br />CV</a>
</div>
Thank you in advantage!
hey guys,
someone already helped me solving the following problem: i wanted to iterate with my up and down arrows through list-items. http://jsfiddle.net/zBjrS/1/
in this example i only had one UL and wanted to navigate through its list-items.
meannwhile i have multiple ul's underneath each other and want to navigate seemlessly through all of them as if there were only one UL. http://jsfiddle.net/zBjrS/2/
any idea how i could do that?
thank you
I am dealing with a webpage that has multiple forms..some basic HTML forms and some AJAX forms. I have a created validation for inputs, let me give an example...if an input has a class="required" whenever a submit button is pressed if any required classes are empty then the form doesnt submit. Which works great...until you have multiple forms with required fields that dont apply to the section your submitting.
I am able to find the closest form $(this).closest("form") and it gets me the form element properly, I then need to be able to loop only through the children of that form. I have tried: .children(':input'), .find('input') and honestly to many to list.
Here is the code for when a button is selected
$('#formSubmit').click(function (e) {
var submit = true;
var form = $(this).closest("form");
var formID = $(form).attr("id");
e.preventDefault();
$(form).children(":input").each(function () {
if ($('#ERROR').length > 0) {
submit = false;
alert("Please fix errors to continue");
}
$('.required').each(function () {
if ($(this).val() == "" || $(this).val() == undefined) {
submit = false;
$(this).css({ 'background-color': '#fef236' });
}
});
});
if (submit == true) {
this.form.submit();
}
}); //End of #formSubmit
Also of interest I have started creating forms with ids that are GUID's so they will be unique and allow me to target things without any issues, just wanted to throw that out there if it can help lead to a solution
I appreciate any help =)