Hi,
I found this menu and i like it but the client asks me to keep the current menu open with respect to a sub page. For example, if i go to Link One page, then it should be opened by default.
Hi ,
I'm trying to get all my form inputs and then create with them an xml string containing there values in order to send them via ajax.
i want this :
<form id="formtest">
<input type="text" name="test1" id="test1"/>
<input type="text" name="test2" id="test2"/>
<input type="text" name="test3" id="test3"/>
<input type="text" name="test4" id="test4"/>
<input type="text" name="test5" id="test5"/>
</form>
to become:
<formtest>
<test1></test1>
<test2></test2>
<test3></test3>
<test4></test4>
<test5></test5>
</formtest>
How can this be done?
Thank's In Advance.
$('.testimonials blockquote p')
.prepend('“')
.append('”');
...prepends and appends TWICE. How do I prepend ldquo + whatever content inside the p + rdquo?
Thanks!
Hello,
Is it possible to get the size of an element after resizing it using $(el).css()?
My code is:
function resize() {
$(".combobox").css('width', '100%');
var width = $(".combobox").width();
}
I've get the real value of the combobox only after calling the function a second time. The first time is gets the width before executing $(".combobox").css('width', '100%');
I suppose this is fault of the DOM not being recreated after the .css(). Is there any way to force DOM reloading?
Thanks in advance!
Hello, I have an easy script, that works in all browsers, except IE(8, haven't tryed lower versions yet).
$('.deleteItemIcon').click(function() {
var deleteConfirm = confirm('Do you really wanna delete that item?')
if (!deleteConfirm) {
return false;
}
});
Can you see a reason, why that shouldn't be working, if yes, how to make it work?
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! :)
Hi
What im trying to do is that when the esc key is pressed on the text
input field (id = txtSearch), some code will run.
this is my code:
$(document).ready(function() {
$('#txtSearch').bind('keyup', function(e) {
var characterCode; // literal character code will be stored in this variable
if (e && e.which) { //if which property of event object is supported (NN4)
e = e;
characterCode = e.which;
}
else {
characterCode = e.keyCode;
}
if (characterCode == 27) //if esc key
{
//do stuff
}
});
}
It doesnt work for me. however, if i would change that line:
$('#txtSearch').bind('keyup', function(e) {
with:
$(document).bind('keyup', function(e) {
everything works. but i dont want to bind the keyup with esc to the
whole document...
any suggestions on how i can bind the the keyup only with the specific
text search element? (or its containing div or something)
Thanks!
I want to submit a form using ajax in the background. I tried:
<div class="form-horizontal" id="form">
<label for="name" class="control-label">Username</label>
<div class="controls">
<span id="name_input"><input type="text" name="name" id="medium" class='input-medium input-square'></span>
<span class="help-inline" id = "ajax_load"></span>
</div>
<div class="form-actions">
<button class="btn btn-red5" onclick="resolve()">Login</button>
<input type="reset" class='btn btn-danger' value="Reset">
</div>
</div>
And the Javascript:
<script type="text/javascript">
var resolve = function () {
jAlert('test', 'test');
$('#ajax_load').html('<a href="#" class="btn btn-mini btn-square tip" title="Reloading"><img src="templates/img/ajax-loader.gif" alt=""></a>');
$.ajax( {
url : 'plugin.php?plugin=test',
type : 'post',
data: $("#form").serialize(),
success : function( resp ) {
if(resp.ajax_success == false) {
} else {
jAlert('test', 'test');
}
}
});
};
</script>
I get an alert, but there is no form submit. I checked that with Live http headers.
Why does it not submit the form?
Hi, I have the following function which limits the amount of characters you can enter into a text area.
What's meant to happen is, if the text length is higher than the text limit, set an attribute of disabled="disabled" on the submit button, but it isn't getting set, my function code is as follows:
function limitChars(textid, limit, infodiv) {
var text = $('#'+textid).val();
var textlength = text.length;
if(textlength > limit) {
$('#' + infodiv).html('You cannot write more then '+limit+' characters!');
$('input#submit').attr('disabled', 'disabled');
} else {
$('#' + infodiv).html('You have '+ (limit - textlength) +' characters left.');
}
}
Any ideas?
This is my Javascript:
$(document).ready(function() {
$('#like').bind('keydown', function(e) {
if(e.keyCode == 13) {
var likeMsg = $('#like').val();
if(likeMsg) {
// Send the AJAX request to like.php
$.ajax({
url: 'like.php',
success: function(data) {
alert('Content: ' + data);
}
});
}
}
});
});
And this is my like.php file:
<?php
echo "It works! :)";
?>
When I press enter on the #like input, it seems the AJAX request is sent and an alert box comes up saying: Content:, but there's no data being sent back from like.php...
I have checked if the file exists and if it's in the same directory and whatever and it is, so I'm pretty much clueless atm.
Does anyone know what could be wrong here? Cheers.
Sorry for such a simple question but I can't seem to find the solution.
I am trying to fade in and out some divs.
Divs have an ID of "div1", "div2", "div3".
My code is:
var Divs = new Array("div1", "div2", "div3");
I want to fade out one div and then fade in the next on top of it.
I have a setinterval that runs every 5 seconds and checked it works.
Inside it is this code:
$(Divs[1]).fadeOut(1000);
$(Divs[2]).fadeIn(1000);
However nothing happens when the timer method is ran. Any ideas?
Hi,
I have created image gallery slider, the images of which scale with the window size. My problem is I can't seem to create the right formula to ensure that the slider is at the right position when the window is scaled.
If I am at the first image and the slider 'left' offset is 0 then the scaling works fine and my offset is correct, however when I am on image two and my slider is offset by say -1500 and then the window is resized, the slider is then at the wrong offset.
Taking this into account I figured I could just add / subtract the new window size difference from the slider offset and therefore have everything in the right position. I was wrong. It works for the first two images but then If I am at the end of my slider on the last image I get a nice big gap between the end of the last image and the border of the page.
Can someone please show my where I am going wrong please? I've spent days on this :(
The relevant code is as follows:
$(window).bind('resize', function(event, delta) {
/* Resize work images - resizes all to document width */
resizeWorkImages('div.page.work div#work ul');
/* Position slider controls */
positionSliderControls();
/* Get the difference between the old window width and the new */
var windowDiff = (gLastWindowWidth - $(window).width()) * -1;
/* Apply difference to slider left position */
var newSliderLeftPos = stripPx($('div.page.work div#work ul').css('left')) - windowDiff;
/* Apply to slider */
$('div.page.work div#work ul').css('left',newSliderLeftPos+'px')
/* Update gSlider settings */
gSlider.update();
/* Record new window width */
gLastWindowWidth = $(window).width();
});
Thanks,
eb_dev
Why does x alerts undefined for iframe but works for embed. I'm grabbing the iframe or embed code from a textarea
<iframe src="http://www.youtube.com/embed/9kiWvkj2ldWiU?hd=1"></iframe>
var textarea = $('#embedModal textarea'),
textareaValue = textarea.val(),
$embed = $($(textareaValue).find('iframe')),
x = $embed.attr('src');
alert(x); //alerts undefined for iframe
If you change find('iframe') to find('embed') and you try with the below embed code. then i'm able to get the value of src, but with iframe i get undefined. Seems strange.
<embed src="http://www.youtube.com/embed/9kiWvkj2ldWiU?hd=1"></embed>
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)
Hi,
I am creating this content slider, you can view/edit here:
http://jsbin.com/esame4
I have put in place setInterval so that animation runs automatically, however, when it is run for the first time, google image is shown but not afterwords. Should be simple but i am unable to figure out the problem.
I am using the .eq() method to select a specific child element of a known element. It appears that the element indices are different in IE and in Chrome/FF, as .eq(2) returns different values depending on browser. (The element I'm looking for shows up as .eq(2) in FF/Chrome, but .eq(3) in IE)
For example,
alert($(this).parent().children().eq(2).text());
shows different results depending on the browser.
Is there a better way of doing this?
dumbest question ever... but I want to somehow fill 'gid' value in data load
gid = 123;
from = 33;
to = 44;
$('#x').load('y', {'range['+gid+'][]' : [from , to]});
so I could get
[range] => Array
(
[123] => Array
(
[0] => 33
[1] => 44
)
)
but with this syntax 'range['+gid+'][]' I get 'missing : after property id'. I'm desperate...
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 included the plugin and written code like
if(page) { $.post(page,{},function(data){callBackFunction(data)}); }
function callBackFunction(data)
{
$('.page_change').html(data);
$('.page_change').effect("bounce", { times:3 }, 300);
$('#submit_show').show();
}
The data change is happening but the bouce effect i am not getting..how do i solve this issue..
Here is the script I am using.
$('.row').each(function(){
$(this).each(function(){
if($(this).find('.name').val()==""){
$(this).find('.name').val(data.name);
$(this).find('.autonomy').val(data.autonomy);
$(this).find('.purpose').val(data.purpose);
$(this).find('.flow').val(data.flow);
$(this).find('.relatedness').val(data.relatedness);
$(this).find('.challenge').val(data.challenge);
$(this).find('.mastery').val(data.mastery);
$(this).find('.colour').val(data.colour);
done=true;
}
if(done==true){
alert("here");
return false;
}
});
});
It just seems to totally ignore the return false and I can't seem to work out why!
$('#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.
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 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.