JQuery :: Is There Any Alternative For .closest?
Oct 5, 2010
I'm looking for an alternative for .closest(). My script refers to jQuery 1.3.2 which is not the latest, but does its job. By trying to implement my code into another script I noticed that this script uses jQuery 1.2.6. Well, 'changing that version was no option'.[code]This is my code. It should be used to clone special comments containing "In[" and in some cases "text".Unfortunately .closest() doesn't work out for me. i'm looking for an alternative.
View 1 Replies
ADVERTISEMENT
Jan 18, 2011
Been trying for about an hour to traverse the DOM to get the value of an input when the quantity is changed, total it and put it back. I have not been very successful unfortunately. erstanding of .closest() is that it will traverse up and find the first of whatever you're looking for. Below is the <ul> structure.
<ul>
<li>Type: Beverage</li>
<li>Price: $<input name="product_price" type="text" id="<?php echo $row['productID']; ?>" value="<?php echo $row['productPrice']; ?>" class="product_price" size="11" /></li>
[Code].....
Seems like it should be simple. I've worked on more complicated jquery stuff. Course my .parent(), .child() skills leave much to be desired..
View 2 Replies
View Related
May 16, 2011
I have the following code. Either of the statementsworks fine in IE8 but not in IE7.
var $parentTabId = $(this).closest("div.column").attr("tabindex");
var $parentTabId = $(this).parents("div.column").attr("tabindex");
I get "undefined" for $parentTabId in IE7. What is the alternative solution which works for both IE7 and IE8 ?
View 3 Replies
View Related
Aug 27, 2009
I want to animate ALL classes called ".article" to opacity=.2 and then fire a callback,which animates ONLY the closest ".article" to ".button" back to opacity=1.Know, what i mean?Here's the script:
$('.button').click(function() {
$('.article').animate({
opacity: '.2'
[code]....
View 1 Replies
View Related
Jul 19, 2010
I am trying to figure out the syntax for the following. For this version I am simply trying to select the 2nd child of the SLIDE HOLDER div. For this test I am just making the width grow. My next pass will be to get the index of the DOT clicked and then pass it to the child of the other parent. Please see line 24. I know this is incorrect but placed it to give you an idea of what I am trying to accomplish.
[Code]...
View 4 Replies
View Related
Sep 30, 2011
I have a table with 5000 rows. In each row I have an html element. myElementList is the list of those elements. Now I need to select all the tr's of these elements. I am using the following code.
[Code]...
This work great in FF. But when I run the same in IE 8. The browser hangs out and a popup messgae appears that propmt for to stop the script.
View 2 Replies
View Related
Jun 16, 2011
I have the following script using the closet method. It works fine for the inner most li tags however the outer li tags don't get seen? So both Root 1 and Root 2 don't get selected but the Sub Cat 1 and Sub Cat 2 get selected fine. I'm sure I'm missing some code to make this work.
[Code]...
View 3 Replies
View Related
Jun 16, 2010
My HTML looks something like the following:
<label for="myTextBox">
Name:<span style="color:red;">*</span>
<input type="text" id="myTextBox"></input>
</label>
In my document ready I have a function which runs 'on blur' of the textbox and hides the span. The following code DOESN'T work to hide the span:
$('#myTextBox').closest('span').hide();
I'm currently using the code below which does work but was wondering why the above code doesn't....
$('#myTextBox').parent().children(':first').hide();
View 3 Replies
View Related
Mar 10, 2011
Basically I want to factor a number and select the two closest numbers to the middle of the factors for example: 20 factors to 1, 2, 4, 5, 10, 20 I want it to return 4 and 5 If the number is has an odd number of factors (has to be a perfect square) I want it to select the middle number and say it twice for example:
64 factors to 1, 2, 4, 8, 16, 32, 64
I want it to return 8 and 8 Would I use an array or what? My code should probably look like:
[Code]....
View 21 Replies
View Related
Aug 6, 2010
I am retrieving an XML document like the following:
<SampleData>
<contentContainer>
<div>HTML goes here</div><div>HTML goes here</div>
</contentContainer>
<moreRecords>1</moreRecords>
</SampleData>
I was using a statement like this to take the content out of the "contentContainer" element and place it into another element:
$('#myDiv').html($(newXML).find("contentContainer").html());
This works great in Firefox, but doesn't in IE. I can use the following in IE using the text method, but that doesn't do what I want:
$('#myDiv').html($(newXML).find("contentContainer").text());
It appears that the html method isn't available with XML. Is there an alternate method I can use to grab a whole chunk of HTML within a portion of my XML document?
View 1 Replies
View Related
Jun 18, 2009
So I have a set of <SELECT> elements that are ajax'd in and out depending on what is selected using the event "change". I know that .live("change") is not fully supported.
View 2 Replies
View Related
May 4, 2011
I have these two functions used from Jquery i am looking for a alternative for them in javascript as i need to completely remove the jquery from the same code...
View 8 Replies
View Related
Nov 11, 2011
I am using a jquery plugin and the code that I am using has fadein() and fadeout() functions but I dont want any fade, could anyone please enlighten me on what the normal one is without the fade,
View 1 Replies
View Related
Jul 29, 2009
<script type="text/javascript">
Above is my JS. What I want to do is, click the button and have the vstar image hidden. Then when I click on the button again, the vstar appears, but now the flower is hidden. And clicking the button again, the vstar is hidden and the flower appears again, and so on...
<div>
View 7 Replies
View Related
Dec 1, 2010
It'd be nice if Superfish was hosted on something like Github so we could better give feedback like this. Anyways, the Superfish plugin [URL]has an additional plugin called "Supersubs," which makes the drop-down menus change their width toaccommodatemenu items on one line.
It's in beta and is a little buggy, I couldn't get it working perfectly on some of my menus--it would make the menu widths wider than necessary. But I discovered a superior way to accomplish the same thing, using only CSS. I've tested it to work in IE6, IE8's emulated IE7, IE8, Firefox, and Webkit (Chrome/Safari).The drop-down <UL>, and children <LI>s should have no width set, and both should be set to display:block; The link should be styled as such: #nav li ul a { display:block; width:auto; white-space:no-wrap; }And that's it! Auto-expanding drop-downs!
View 1 Replies
View Related
Dec 3, 2011
An example:
tabContent.css('width', '0')
.css('opacity', '0')
.filter(':eq(0)')
.css('opacity', '1')
.parent()
.find('.one-tab')
.addClass('active')
.css('cursor', 'default');
Now I want to apply the parent of tabContent a width, only if a condition is true. I do this, and works, but I don't consider this is a proper way:
tabContent.css('width', '0')
.css('opacity', '0')
.filter(':eq(0)')
.css('opacity', '1')
.parent()
.each(function() {
if (/*condition is true*/) {
$(this).width(aWidth + 'px');
}
$(this).find('.one-tab')
.addClass('active')
.css('cursor', 'default');
});
Is there a better way instead of using each() which is actually made for loops? In this case there is only one element.
View 3 Replies
View Related
Jun 4, 2010
I'm currently using this bit of code which submits some form values to a php script which then returns the results into the target html as specified.
Code:
$("#ajax_totals").load("shop/calculate_order_cost", $("#shop_form").serializeArray());
However what i'd like to do is submit the form items using serializeArray but then return multiple items from the php script and insert them in multiple places on the page, not just in the form itself.
I know i could simply use that line of code 4 times over with 4 different html targets but i don't feel it is very efficient or DRY. So i'd like to know the best way to submit multiple values to a php script, return multiple responses and use those responses in multiple places in the html.
View 6 Replies
View Related
Mar 16, 2010
I have been using RHS, but in IE, it sometimes doesn't work the way I expect. Also, last update was a long time ago.
So, does anyone know better alternative for RSH?
View 3 Replies
View Related
Jul 23, 2005
Currently I use an onbeforeunload method, to do call various tidy up
methods when a user exits my web application - however I now need to add
additional support, for users migrating to Sun's JVM.
My understanding that the onbeforeunload call is a Microsoft one, and
the net result of having it in a page used by a SUN JVM user is that the
browser does not close.
Does anyone know of an alternative to this method, that is supported
by Sun's JVM?
View 4 Replies
View Related
Sep 30, 2005
In my webpage I have an embedded Windows Media Player and an unordered
list with a table of contents.
When playing a video, the Windows Media Player is triggering events for
new 'chapters'.
The corresponding chapter in the unordered list is then highlighted
with css.
The list can contain up tot 100+ items. Because the page itself should
fit the screen without scrolling, i put the list in a scrolling div.
I also want the div to scroll automatically in order to keep the
current chapter inside the visible scope of the div.
Right now i do this by initually creating an anchor for each listitem.
When an chapterswitch event occurs i scroll to the corresponding
chapter with the folling line of Javascript code:
window.location = "#" + ListItemId;
There is one problem; the annoying tick sounds in IE. For my
application it is not rare to have 25 'chapters' switched in one
minute, so that's an awful lot of ticking.
I was wondering if it is possible to automatically scroll up or down to
a specific point in a div without the browser making any sounds.
View 3 Replies
View Related
Jul 20, 2005
I was wondering if anyone can help me? I am having some problems wit
the <noscript> tag.
I actually use it to block banner advertisements from being displaye
in my website. I have used it at the <body> tag section and look
something like this:
<noscript>
<body>
</noscript>
What it does is stop the banner advertisement offered in most fre
websites from loading.
My question is how come it does not stop the banner from loading if
was to view the webpage in my Pocket PC using Pocket Internet Explore
Pocket IE)?
Everytime I load the page in Pocket IE, it displays a standard banne
that is found in all pages viewed using Pocket IE. I looked around fo
some answers and I found out that Pocket IE found in the Pocket PC 200
does not support the <noscript> tag.
Is there another way around this? I have written some pages that wil
load in my Pocket PC and I find it very annoying to see the banne
advertisement at the top. Code:
View 2 Replies
View Related
Feb 28, 2011
Is there an other way to link to an element on the same page without using anchor URLs?
View 18 Replies
View Related
Dec 7, 2006
I was wondering if there was an addLoadEvent alternative, that could be used before all images are loaded? I think it's something like when the DOM is ready...
View 1 Replies
View Related
Aug 29, 2009
this is the code I'm working on:
Code:
var tabs = new Control.Tabs('menu');
var pattern = 'tab=';
var nStr = location.href;
if(nStr.match(new RegExp (pattern,'gi'))){
var id = nStr.split(pattern);
[Code]...
It searches for the query string 'tabs=' and then splits the result to get the id of the tab. Then it uses this to set the active tab. If the url doesn't include the query string it set the tab to the first one.
The code works but it uses Eval to convert the id string (id[1]) to a variable and I was wondering if there was an alternative.
View 2 Replies
View Related
Jul 23, 2005
Is there a more concise way to do something like the the
desired code below?
The gripe is with the try-catch syntax. It takes *way* too
many lines of code to evaluate a conditional expression
when zero or more parts of the conditional expression may
trigger an error. In this case, the trigger is a call to
a non-defined (null) object.
In other words, how can you do a more simple 'try' statement
that simply spits out true or false, depending on whether
the 'tried' code threw an error or not?
Defining a function don't seem to work because you
can't pass the 'try' code as an argument. Extending the
'Global' constructor is not an option, so now what? Code:
View 3 Replies
View Related
Jul 23, 2005
Is there a possibility to do a string replace in javascript without regular experessions. It feels like using a hammer to crash an egg.
View 24 Replies
View Related