jquery-selectors

jquery conflict with identical scripts

I am using jquery to load content into tabs, and switch the tabs on click. My problem is that one one page I am using this "tab switcher" twice, and it is causing a conflict. I am not too experienced with jquery, so my problem probably lies in the fact that I am creating the function twice in the head. Here is my jquery (you will notice ...

Problem facing parsing apostrophe in jquery.html()

I am stuck with a weird problem of parsing an aphostrophe. I cant use an escape character in "test" selector because this value is coming from the DB. How do i display this correctly.. :-( Script is as follows $(document).ready(function() { var getVal = $('.test').text(); $('.newstest').html(getVal); }); Html Code is as follows <div...

How to select the inverse of the selection

I am successful in selecting the first <li> of the <ul> i want to select the remaining of the <li> except the current selected <li> . i.e., (inverse) How can I select it. Please help EDIT 1 As per request var newEle = $(str); //str contains a <li> i.e., <li>Some content</li> $(newEle).hide(); ...

How to access text from neighboring table cell?

I have a set of search results presented in a table. Each row has a radio box. Once the user has selected a row I would like to access the description text from the neighboring cell. Using jQuery or straight javascript, what is the best way to do this? <tr class="odd"> <td class="chosenCode"><input type="radio" value="123" name="chos...

What's the correct jQuery selector for this? I want to get all tr with attr x, which are directly beneath (same level) given tr.

Hi all, I'm currently working on something like a tree, and I want to be able to fold/unfold children. I guess the most easy way to get this is by using nested lists, but I can't use them because I don't have access to the HTML code. This is the relevant simplified HTML code: <table> <tbody> <tr rel="1"><td><a href="#" id="...

jQuery to get next match in the DOM after a particular element

I hate to admit it but I'm stuck trying to figure out how to do this. e.g. pretending you have the following structure: <div> ... <div> <ul> <li> <a href="..."><img class="foo"/></a><!-- "previous" --> </li> <li> <a href="..."><img class="bar"/></a> </li> <li> <a href="...">...

How do i refresh the page in Jquery when the dialog Modal is closed

I have some set of values updated in the modal and the modal is opened on the same page . on closing the Modal How can i refresh the Page in jquery $("#dialog-modal").bind('dialogclose',function() { //How Do i refresh the current Page. )}; ...

Can't identify document objects for Context Menus in SharePoint Lists

I'm trying to use JavaScript to find the context menu items being shown and selected from the lists (such as a document library) in SharePoint. I've tracked down a few different function names within core.js, (such as DispEx() and CMOpt()) but I really am having a hard time following the unhelpful variable name mess. My understanding is...

jQuery selectors and variables

Is there any obvious advantage in performance in writing var e = $("#el"); e.css(...); e.attr(...); .... e.click(...); instead of $("#el").css(...); $("#el").attr(...); .... $("#el").click(...); ? ...

How can we run a function when I clicked on Radio button in jQuery

I have three radio buttons and when I click on one radio button I want to have some functionality using jQuery. ...

jQuery "not readonly" selector

I'm looking for something along the lines of... $(':input:not(readonly)') // all inputs which are not readonly but struggling to find the syntax. Any pointers? thanks ...

Why doesn't jQuery bomb if your selector object is invalid?

Was recently using some code along the lines of $("#divMenuContainer:visible").hide("explode"); However after some time spent trying to get it to work I realized my selector was referencing a div that didnt exist. The result of the query was simply that it didn’t execute. Obviously this is by design, could anyone explain the logic...

Problem in using the datepicker in jquery

i have a html form with 3 fields "dateFrom" and "dateto" and iam using the Jquery datepicker for this fields .Iam using form validation plugin and to validate the required fields. $(document).ready(function(){ $("#dateFrom").datepicker({ dateFormat: 'dd-M-yy' }); $("#dateto").datepicker({ dateFormat: 'dd-M-yy' }); }); Markup: <...

jQuery set then read readonly attr on textbox

​<input id="test" type="text" value="text" />​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​ alert(​$(':input:not([readonly])').length);​​​​​​​​​​​​​​​​​ // 1 $('#test').attr('readonly', 'readonly'); alert($(':input:not([readonly])').length); // 1 $('#test').removeAttr('readonly');​​​​​​​​​​ alert($(':inp...

How do I hide the parent element of one that triggered an action with jQuery?

I have this code in html (notice the numers 1 and 2in the outside and inside elements): <div class="list_item" id="item_1"> <div class="list_item_int">My first line</div> <div class="eval_buttons"> <div class="approve" id="1"></div> <div class="dismiss" id="1"></div> </div> <div class="list_item" id="item_2"> <div class="lis...

jQuery Execute Order

I'm using the following jQuery plugin and it executes when there's a click action on the specified element : http://www.andresvidal.com/labs/relcopy.html I also created a click function for the same element, but I expected it to execute after the plugin. However that isn't the case, the click function always executes first, thus causin...

Help with a regular expression for a jquery selector

Need help writing a regular expression to match any class containing the phrase block-container I've come up with this: '[class^=block-container]' but I need help writing the wild cards around the phrase block-container. Examples i need to match: nav-block-container-left block-container-whitebox right-block-container ...

Find apostrophe's and replace with some other character

Hi.. I am stuck with a problem, which has got to do with Apostrophe's. How do i find and replace all apostrophe's with some other character. The code is as follows. Script jQuery('.note').each(function() { var final = jQuery(this).text(); jQuery(this).html('<div class="solutionnotes">'+final+'</div>'); var ht...

JQuery - Select by attribute?

This works in Opera but apparently nothing else. HTML <input type="checkbox" name="iphone" value="checked" checked="checked" /> <input type="checkbox" name="photocart" value="checked" checked="checked" /> JS $("input[name=iphone]").attr('checked', 'checked'); $("input[name=photocart]").attr('checked', 'checked'); $("input[name=iph...

jquery - Hide #test if anything else than #test or its children is clicked?

The title sums it up. I simply want to hide #test when anything else than #test or its children is clicked. Thanks a bunch! ...