converting xml to json
Hi how do i convert the following xml to json format //xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <response> <node label='root1' data='first|second|' type='template' id='1' checked="0"> <node label='parent_root1' type='module' id='0' data='parent_data_root1|' checked="0"> <node label='child1_root1' id='1' data='child_root1_1|' checked="0"/> <node label='child2_root1' id='2' data='child_root1_2|' checked="0"/> </node> <node label='parent_root2'
how to define Regex to find Each repeating string in a link till the closest preceding character?
I have the link, http://www.mainlink.com/subcategory/?q=Type%x32|Size%undefined|yollo Aundefined For the link, how to get each "undefined" from the link and for every instance of "undefined" get all the characters from "undefined" to the closest "|"(separator) preceding that undefined and replace with "". Is this even possible?
passing parameter
I have a table that has a 'edit' image to allow the user to edit that row <img src=Graphics/edit.gif alt='Edit' onClick="NoteEdit(13427) currently using javascript I call the function NoteEdit() passing to it the Reference # of the row I want to edit I am trying to do this in jquery but have no clue at this point the js function is function NoteEdit( iRef ) { frm.NoteRef.value = iRef ; frm.cmd.value = "NOTEEDIT" ; frm.submit() ; }
Detect if two rotated divs collide using JQuery
I would like to detect if two rotated divs are colliding. I know how to do it if they're not rotated, but I don't know how to do it when they actually are. I have tried some collision plugins such as jQuery Collision (http://sourceforge.net/projects/jquerycollision/), but they have not worked when the div is rotated. I have made the rotation of the divs using CSS's transform property.
controlling movie sequence and combining with sprite sheets
hi all, having a real nightmare trying to make something work out... trying to explain it may be a task in itself!!!! so i want to use the "sprites.zip" method to create a navigation/menu that will play the sprite sheets either when the link is rolledover/clicked or if the sprite itself is rolledover/clicked... the attached files seem to work okay for this part of things... when i duplicate the link/sprite it works fine. sooo.... what i am trying to do and struggling to get to grips with is this...
Execute php in new tab.
Hi all, I need help to execute in new tab a php file via ajax. I have this code: <script type="text/javascript"> function registroClasse(arg1) { $.ajax({ type: "POSTT", url: "registroClasse.php", data: {cla: arg1}, }) } </script> Thanks. Tegatti
Selector Context not working as advertised.
On this page http://api.jquery.com/jQuery/#jQuery-selector-context the instructions for using the selector context says: By default, selectors perform their searches within the DOM starting at the document root. However, an alternate context can be given for the search by using the optional second parameter to the $() function. For example, to do a search within an event handler, the search can be restricted like so: $( "div.foo" ).click(function() { $( "span", this ).addClass( "bar" ); });
Recognizing DOM add for leave page naviation warning
away from a page without submitting. I am having issues when the page uses document.add to overwrite radio buttons and textboxes. Everything else works. What doesn't work is when the user clears a textbox or radio button. The way it gets cleared is with document.add. I want to include this segment of code on multiple pages, so it must be dynamic. Here is what I have so far: var warnMessage = "You have unsaved changes on this page!"; $(document).ready(function() { $(document).live('change', ':input',
Paginate results from ajax call
Hello, I'm currently working on a project (in codeigniter) where you have a table showing data from the database, and I have 3 selects, each select has the on change event, base on the id of each select I do an ajax call to filter the table information, I'm using the codeigniter pagination controller to paginate the results, all work ok but. What if I do the ajax call and the result is 300 rows?, I would like to paginate those results too. What I wanna do is, get all rows and paginate by n quantity
key word search from google issue
Hello get data from this url : "http://google.com/complete/search?output=toolbar&q=hello" $.ajax({ url: "http://google.com/complete/search?output=toolbar&q=openerp", type: "GET", async: true, dataType:'jsonp', success: function(data) { console.log("done"); }, }); ERROR : Resource interpreted as Script but transferred with
Basics
Hi, I am on and off on jQuery - so be patient with me please. I have a question on the very basic topic: $('#banner') 1) is this a query that finds element with id = banner? If so what is the root document to search from? 2) is that a statement to create new element with the id == "banner"? Regards, Janusz
How do assign a form field element?
This should be simple but it's preventing the validation script from working properly. I'll explain: Essentially, I have four form fields, all of which are prepopulated with a prompt ("Enter name here" sort of thing) which become blank on focus and repopulate on blur. Only two fields require validation which means the "Please enter your surname" prompt (Surname is not a required field) is being posted. At the foot of the validation process I need scripting like this: if ($("#inf_field_LastName").val()=='Nachname'){
Change function to take in class name
I have a page that produces the following html. Check all checkbox html: <span class="chkHeader2"><input id="CPH1_dlYear_cbCheckAll" type="checkbox" name="ctl00$CPH1$dlYear$ctl00$cbCheckAll" checked="checked" /></span> Check box controls being produced by my page: <span class="chkItem2"><input id="CPH1_dlYear_chkYear_0" type="checkbox" name="ctl00$CPH1$dlYear$ctl01$chkYear" checked="checked" /></span> <span class="chkItem2"><input id="CPH1_dlYear_chkYear_1" type="checkbox" name="ctl00$CPH1$dlYear$ctl02$chkYear"
.change event question
Hi The following script adds a value of '3' to the rDecision field if the domain in the email address is gmail.com etc. This works when you click the button, but I would like the value to be added without having to click on the button. I understand this is done with .change but I'm not sure how? Can anyone help? Thanks <script> function checkEmail() { var email=$('#txtEmailID').val(); var filter = /^([\w-\.]+@(?!gmail.com)(?!yahoo.com)(?!live.com)(?!hotmail.com)([\w-]+\.)+[\w-]{2,4})?$/
On a .post, why isn't my .done(), .fail(), and .always() methods working?
None of my alerts in the following code are working? <script type="text/javascript"> // Wait until the doc structure is parsed and the browser has created the DOM tree. jQuery(function() { // Attach a submit handler to the form $( "#loginForm" ).submit(function(event) { // Stop form from submitting normally event.preventDefault(); // Get some values from elements on the page: var userId = $.trim($('#j_username').val());
Validating radiobutton must have selected value
I am trying to validate with jQuery that at least one input is checked inside the .QuizAnswers div. Any thoughts? <div class="QuizAnswers"> <div class="QuizAnswer"> <input type="radio" value="2" name="questionAnswer"> <label for="questionAnswer">a. Taxilane Centerline</label> </div> <div class="QuizAnswer"> <input type="radio" value="3" name="questionAnswer"> <label for="questionAnswer">b. Movement Area Boundary Line-Stop!</label> </div> <div class="QuizAnswer"> <input type="radio" value="4" name="questionAnswer">
Short yes/no question
Hello, Is there any jquery majik that will close all popups from a parent screen? I have a screen that has the potential of opening 4 different popups. And no I didnt write it ... Thanx
about jquery connectivity online
i have been trying to add html elements after clicking on ADDNEW link but the link doesnot work as project doesnot connect with jquery file.so please help to connect it online..The code is written in netbeans <%-- Document : index Created on : Jul 17, 2014, 12:04:15 AM Author : AnishP --%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title>
$ is not a function error
HI folks, Getting this error for my js functions. I’m using noconflict. Any ideas how I can fix this? Here is the start of my file:
// globals
var recepients=Array();
var groups=Array();
var classes=Array();
var grpnames=Array();
var recnames=Array();
var classnames=Array();
var directorywindow;
var total=0;
jQuery.noConflict();
jQuery(InitSite);
// functions declared from here on
function InitSite()
{ if(jQuery("#userfile").size())
{
jQuery("#userfile").MultiFile(
{... etc
Event binding not working as expected when set on the parent.window
I'd like to know if the issue I'm going to describe is a bug. If I bind an event from an iframe content to its parent window and use a property set to the iframe content window in order to update a counter whenever I refresh the iframe page the counter property doesn't seem to be correctly reinitialized. The iframe page should set the window.counter to 0 each time the page is reloaded, but the counter property seems to keep previous value. I've been able to reproduce this issue on Chrome and Opera.
expand and collapse with changing graphic!
Hi Jquery masters!!! I need your help - I'm trying to build a simple menu that expands and collapses - when a menu item is selected and the expand happens - a number on a map lights up. (SEE ATTACHED GRAPHIC - it's probably way easier to understand by looking at - as opposed to my horribly written explanation). The expand and collapse shouldn't be too difficult (but I'd love to hear suggestions!!!) but how do I make the number change colors/light up on the map when the menu is selected/expanded???
Need help getting the length of :checked usin .on("click")
Hey Guys. I wrote the script below to display an alert message if the user has selected more than 2 items. But it doesn't seem to be working for me... Any help would be really appreciated. Thanks!! http://jsfiddle.net/eldan88/qyu9N/ <script> $(function(){ var $checkboxes = $("input[name*='max_allowed']:checked"); var $checkbox_len = $checkboxes.length; var $max_len = 2; $($checkboxes).on("click", function(){ if($max_len > $checkbox_len){
success block is not getting executed
The website that I have worked on has a requirement to reload the page based on the city selected from the drop down. I have implemented the functionality but for some reason, the success block is not getting executed and due to this the page url is appended with '/undefined'. The issue pages of the web page is below http://www.localcloudstore.com/ this is the home page and http://www.localcloudstore.com/Bangalore/category/restaurants this is a inner page. There is a different search section for
How to use a increment to show in a json string
I need to text the return of a json file and would like to know how I increment a variable like i++ inside a json string so that to display it on the screen. So, in my json test that I receive two line per time, I would be able to see: Name Increment X 1 Y 2 It sends the same two lines again and I should have: Name Increment X 1 Y 2 X 3 Y 4
Is there a way to overlay an image on a jqPlot line chart?
Is there a way to overlay an image on a jqPlot line chart? I'm trying to figure out if it's done in the jqPlot framework... or lower level. https://groups.google.com/forum/#!forum/jqplot-users http://forum.primefaces.org/viewtopic.php?f=3&t=39048 Thanks, -- Robert
How can I use ranges in a switch case statement using JavaScript?
i try to user switch (range of number) but it seems not work? can you help me check it where is the problem? http://jsfiddle.net/hukuto7750/beu7q/ thanks
Error: Unexpected call to method or property access.
Error: Unexpected call to method or property access. I was getting the above error in IE8. Because of this i am unable to load my angularjs template. looking for solution..............
How to fire event on future dom elements
I cant get my function to fire on elements that are added to dom after domready Im trying to remove an input box if it's cleared out by backspace or however $(".CC").on("keydown", ".CC", function(){ var $this = $(this).val(); console.log($this); if ($this == "") { var $id = $(this).attr("id"); $("#" + $id).remove(); }
.off() trouble
I'm having trouble with the .off() method: $(document).on("click", ".npc", function(){ $("#body").append("<h3>Blah</h3>"); $(this).off("click"); });I'm trying to unbind the click event from .npc class after it's been clicked on, but it continually appends to body. I've also tried this: $(".npc").on("click", function(){ $("#body").append("<h3>Blah</h3>"); $(this).off("click"); });In this case it's not appending at all. Maybe because the .npc class doesn't exist initially on page load?
Cannot use data- as an object property?
Hi. Is it not possible to do this? var obj = { data-id : "hello" }; I get unexpected token '-'
Getting data from a SQL Server DB and accessing it in Jquery Library (not code on default aspx)
Hello, I'm quite new to jquery and I was wondering how to do the following: Just to give an idea, what I'm trying to achieve is getting a list of holiday dates from a Database and disable them in a jquery datepicker. 1 - Need to get data from SQL Server DB (this can be done Server Side one time). I already have the Stored Procedure to return the data and its basically 2 columns, 1st column INT , 2nd column STRING. 2 - My real problem now is I want to pass this data to a jquery file that
Documentation bug in parent()?
I noticed the following in the documentation for parent() at http://api.jquery.com/parent/ Given a jQuery object that represents a set of DOM elements, the .parent() method allows us to search through the parents of these elements in the DOM tree and construct a new jQuery object from the matching elements. The .parents() and .parent() methods are similar, except that the latter only travels a single level up the DOM tree. It seems that the first sentence is actually describing the parents()
How to add response delay for mouseenter without using setTimeout or hoverIntent plugin..?
$(".plus").mouseenter(function(){ var $header = []; $('.headerCls').each(function() { $header.push($(this).html()); });
jqueryObject.selector property
Hello, The documentation http://api.jquery.com/selector/ says that the selector property is going to be deprecated soon. However, i see that the selector property is available in all versions of jQuery upto 2.1.1. So does this mean that this feature is going to be removed from all versions or only in the latest version? Also, can you explain why this is being deprecated. This feature seems quite useful when trying to identify the element on which say, an event listener was registered. We are trying
id on click help
I'm having a problem with referencing #dropdown-suggestion ...when I use the on click function to create a action nothing happens...any ideas please...thank you...other than that all code works great $( '#' + selector).data( 'ui-autocomplete' )._renderMenu = function (ul, items) { var that = this ; $.each( items, function ( index, item ) { that._renderItemData( ul, item ); }); $(ul) .attr( 'tabindex' , -1 ) .addClass( 'dropdown-menu' ); $( '<li></li>' ) .append( "<a>Hide Suggestion</a>" ) .addClass(
How to detect if id exists on window.opener screen
Hello, Im trying to detect if an id exists on a window.opener to keep from creating a duplicate. But Im getting an error. var $id = this.value; if(window.opener.$("#" + $id).length == 0) { window.opener.$("#CC").append('<br><input type="text" name="SCCC" ...id="MYID" Im getting the below error. Uncaught Error: Syntax error, unrecognized expression: #MYID
check back in $.post
Guys, good morning! I'm in trouble and need your help. My situation is as follows: In the onclick of a form button, I call a function called register (below code) function register(){ $.post("register.php",{usu_email : $("#register_usu_email").val()}, function(data) { if(data === 'yes'){ ... }else{ ... } }); }; The goal is to verify if the email is already registered in the database, if so, returns a 'yes', and do a script for error. Within
Dynamic width issue
Hi, I'm checking for the presence on a page of a class in my code called li.fourthstep (it's a button in a menu bar) If that class exists, I want the width of a class called .next (it's a button) to have a margin-left of 660px. If li.fourthstep doesn't exist, I want the margin-left to be 785px. Can't get this to work. Here's my code. $(document).ready(function() { if ($('li.fourthstep').length > 0) { $('.next').css('margin-left','660px'); } else { $('.next').css('margin-left','785px'); } }); Thanks
stopPropagation not working as expected
Hello. I cannot get stopPropagation to stop the bubbling. I don't understand why; isn't this what it;s supposed to do? I am expecting that when I click on the "test" element that it will alert ('test clicked') and then stop ('prop failed') from being alerted. http://jsfiddle.net/E6NS5/7/ <div id="wrapper"> <div id="content"> <div id = "parent"> <div id="test" class="button">Top Button</div> </div> </div> </div> $('#parent').click(function () { alert('prop failed');
jQuery .offset() in jquery 2.1.1 ?
Hi, I just hit to problem while trying to use jQuery .offset() in jQuery 2.1.1 and I just found out that there isn't such a method called offset without any parameters that returns something so my try to get the left and top properties from the offset() method was unsuccessful. Can anybody help me use the .offset() method in jQuery 2.1.1? Or is there any alternative way to do so?
Next Page