jquery

JQuery - Hardcoding HTML in Javascript - Is there a better way to dynamically create dom elements?

I have a lot of messages, and raw HTML that I hard code in my javascript code, such as: var subjectId = $(subject).attr('subjectId'); var subjectName = $(subject).attr('subjectName'); var html = "<table id='invitations' class='invitations' width='100%'><tbody>"; $(subject).find('group').each( function() { var groupId = $(this)...

jquery - detect if selector returns null

What is the best way to detect if a jQuery-selector returns an empty object. If you do: alert($('#notAnElement')); you get [object Object], so the way I do it now is: alert($('#notAnElement').get(0)); which will write "undefined", and so you can do a check for that. But it seems very bad. What other way is there? ...

jquery serialize and $.post

I'm trying to send a lot of data from a form using the $.post method in jQuery. I've used the serialize() function first to make all the form data into one long string which I will then explode serverside. The weird thing is when I try and send it using $.post it appends the result of the serialize() to the URL as if I was sending it usi...

How to iterate through a list of strings returned from a web service using JQuery

Hi This is my first JQuery experience and I'm on quite a tight deadline. It's a bit of an embarrassing question, but here goes. I'm calling a web service that returns a list of strings (which works and returns OK). Code is below $(document).ready( function() { $.ajax({ type: "POST", contentT...

How to calculate RadGrid cell value on Client side?

I have telerik RadGrid which is in edit mode. Each cell contains NumericTextBox. Is it possible to calculate one cell based on other cells in the same row (on client side). For example if I have a row which contains cells like price and item I want on every change to calculate total price but on client side, without going to server sid...

jQuery: div pops back to full size after animation

In the jQuery example below, I have one div inside another. When I animate the inner div down to a width of 0, the outer div (which has absolute positioning), decreases in width along with it. This is desired. The trouble is that after the animation is complete, the outer div pops back to its original size. Is this expected? How can I ...

jQuery HTML select drop down need two values but display/submit one. Second value used to select another drop down option

Ok here goes: I have a SELECT drop down option with US state names <select> <option value="ca">california</option> <option value="ut">utah</option> <option value="mi">michigan</option> </select> but I also need to associate another value with this that's hidden to the page view. I can not use class, name or id to populate the s...

Isolating jQuery functions

I have some jQuery code that highlights a link when clicked, and changes the font size and color of certain links on the page. My problem is that some of the functions in my jQuery are executing on ALL the links on the site, rather than just the ones in the div that I am trying to target. Here's my code so far: $(document).ready(f...

jQuery Table to CSV export

I'm using the jQuery Table to CSV Plugin. I've altered the popup so that it tells the browser to download a CSV file. It was: function popup(data) { var generator = window.open('', 'csv', 'height=400,width=600'); generator.document.write('<html><head><title>CSV</title>'); generator.document.write('</head><body >'); generato...

traverse to parent td and tr from a item click in a cell

I have a link ( anchor ) tag in a table cell on every row of an html table. On click of this anchor tag I want to use jquery ( preferably) to traverse back to the parent td and tr and get object reference to it. how can i use jquery at best here to navigate\traverse in dom. I can do a method like this but not sure if jquery has better...

jQuery on iPhone/Android/BlackBerry

I don't have any of the devices to test at the moment. I guess I'll start using the emulators later on. We're looking to offer mobile support. I was wondering how jQuery or even javascript renders in their respective browsers. What works? What doesn't? Any tips? Advice? ...

jquery and html elements that run at server

Hi, I have a element contained in a user control (header). This div includes sub divs inside it. One of them includes user options. The user options div () displays the username of the logged in user, and couple of links related to already signed in users such as logout, settings etc.. the "user_options" div is absolutely positioned wi...

How to create animation in jQuery to move a div from left to right?

How to create animation in jQuery to move a small div from left to right in 10 seconds? thanks! ...

Is it possible to clone html element objects in JavaScript / JQuery?

Hi, i am looking for some tipps how to solve my problem. I habe a html element (like select box input field) in a table. Now i want to copy the object and generate a new one out of the copy, and that with JavaScript or jQuery. I think this should work somehow but i´m a little bit clueless at the moment. Something like this (pseudo co...

Proper way of lazy-loading a single select box options via ajax once clicked.

I have a select box that should be populated only when clicked. The query involved takes a long time so I'm deattaching it from the standard data shown on the page. I have implemented the function loadMyData(element, id) which does an ajax request and returns the data as JSON. Then it populates the select box. the event is binded to t...

scroll the other grid automatically using jquery

I have two grids with same number of rows ( also same height). Both these grids have vertical scrolls ( using style overflow) When I perform the vertical scroll on the second table , I want the first grid to scroll automatically by same number of rows up/down. ...

How do i convert a string to a JSON object in JQuery?

I have a string in my db I want to pull into my page and convert to a json object. [ {id: 1,title: "Long Event", start: new Date(2009, 5, 6, 14, 0),end: new Date(2009, 5, 11)}, {id: 2,title: "Repeating Event", start: new Date(2009, 5, 2)}, {id: 3,title: "Meeting", start: new Date(2009, 5, 20, 9, 0)}, {id: 4,title: "...

Browser dependent problem rendering WMD with Showdown.js?

This should be easy (at least no one else seems to be having a similar problem), but I can't see where it is breaking. I'm storing Markdown'ed text in a database that is entered on a page in my app. The text is entered using WMD and the live preview looks correct. On another page, I'm retrieving the markdown text and using Showdown.js ...

Select top level columns from a table with nested tables using jquery

I have the following html structure (which is generated and I can't change): <table id='tableID'> <tbody> <tr> <td> <table>...</table> </td> <td> <table>...</table> </td> <td> <table>...</table> </td> </tr> <tr> <td> <table>...</table> </td> <td> <tab...

ASP.NET Master Page + pageLoad() = kills jquery?

In my MasterPage, I have a ScriptManager that has a ScriptReference to my jquery.js file. This has always worked with no problems, all content pages that utilize jquery work fine. Recently, I added the following javascript script block at the end of my MasterPage: function pageLoad(sender, args) { } By simply adding the above pa...