jquery

Get value of multiselect box using jquery or javascript

In the code below, how to get the values of multiselect box in function val() using jquery or javascript. <script> function val() { //Get values of mutliselect drop down box } $(document).ready(function() { var flag=0; $('#emp').change(function() { var sub=$("OPTION:selected", this).val() if(flag == 1) $('#new_...

How to load jqtouch on-demand

I'm trying to load jqtouch on-demand like so: <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(function() { $.getScript("js/jqtouch.min.js", function() { $.jQTouch(); }); }); </script> Firebug outputs: $(_3c.selector).tap is not a function If I inc...

Binding elements when modal window loads from AJAX (jQuery)

I'd like to set up a drag'n'drop list inside a modal window. The window's content is loaded via an AJAX call, so I believe I need to use jQuery's .live() method. Here is my current code: $('#cboxLoadedContent').live('load', function() { // Event for sortable page lists $('ul#pageList').sortable(); }); How can I set up binding...

How to use jQuery .each() - I get a value, but it's the wrong one

I am returning a JSON object (as a String) through a servlet. The JSON object looks like this: {"3":"Martin Luther","30":"Boris Becker","32":"Joseph Goebels","19":"Leonardo Da Vinci","31":"Adolf Hitler"} My jQuery looks like this (the submission of data is correct because I get a proper looking result from the servlet): $.ajax( { ...

How to replace '<p>' with '<li>' in an array in jQuery?

Hi, Let's say I have this $(document).ready(function() { var array = $.makeArray($('p')); $(array).appendTo(document.body); }); }); <p>how</p> <p>are</p> <p>you</p> <p>baby?</p> If I want to replace <p> with <li> and expected output is ... <li>how</li> <li>are</li> <li>you</li> <li>baby?</li> What should I do? Thanks i...

Showing right sub-ul of parent ul menu

Hello, i have this html menu: <ul id='main'> <li class='active current' id='lighty'> <a href='/'>Lighty</a> <ul> <li class='sub'> <a href='/'>Hem</a> </li> </ul> </li> <li id='community'> <a href='/community'>Community</a> ...

How to trigger only if it match 2 events in Jquery?

I want to have a event that only triggers when you press space and move your mouse at the same time. How can you make that? ...

Destroying nested resources in restful way

I'm looking for help destroying a nested resource in Merb. My current method seems near correct, but the controller raise an InternalServerError during the destruction of the nested object. Here comes all the details concerning the request, don't hesitate to ask for more :) Thanks, Alex I'm trying to destroy a nested resources usin...

Best way to sort MySql results based on two columns and show results using pagination?

I want to sort results set first based on one column and then based on second column. I know how to do it on server side. And then I want to show these results with pagination feature. Question: would it be better to do it on client side via ajax in jQuery? I'm using Zend Framework. Would Zend_Paginator module be useful in this scenario...

Javascript Regular Expression matching

Hello, By using the pattern from here, I want to check while a user fills in the #id_phone text input field, if it is matching to the pattern, use the value of #id_phone to fill #id_new_phone's value. This doesn't seem to work for me. $('#id_phone').change(function() { var myPattern = new RegExp(^0\(5\d{2}\) \d{3} \d{2} \d{2}$); ...

jquery 'tablesorter' zebra widget do sort all column unnecessarily!

i m using jQuery tablsorter plugin, it's working perfect,but now problem is ... i want to enable sorting only on 1'st and 3'rd column, and i also want to show different color of alternate row. i used widgets:[zebra], but using widget zebra, it enables sorting on all column as well as images(asc.gif,desc.gif,bg.gif) is also appearing on ...

Change text fields background colour if negative number using Jquery/CSS

Hi, I have the following text input on a budget calculator form which displays the final balance... <tr><td align="right"><b>Balance: &pound;</b></td><td align="left"><input type="text" class="res" name="res" id="res" size="10" readonly="readonly"></td></tr> How do I go about setting the background of the input to red using css and j...

Cannot select/edit TineMCE-generated table

I'm currently using TinyMCE edit in my drupal-website, problem is that beneath the editor, some of the table is sticking out. If I remove the height set by javascript with firebug, it looks fine, even after resizing. So I want to remove the height with JS, I've put this function at the end of my page: $('table#edit-body_tbl').removeAt...

Create a JSON Array using Java

Hi I want to create a JSON array. I have tried using: JSONArray jArray = new JSONArray(); while(itr.hasNext()){ int objId = itr.next(); jArray.put(objId, odao.getObjectName(objId)); } results = jArray.toString(); Note: odao.getObjectName(objId) retrieves a name based on the "object Id" which is called objId However I get a v...

How to horizontally sort divs using Sortable in JQuery

I am looking to sort my divs horizontally in a container div. I found an example on JQuery website but that is vertical sorting. I want it horizontal. I want to do it sorting in #sortable Div. Will you please guide me how can I convert this vertical sorting in horizontal manner. CSS <style type="text/css"> #draggable1 { width: 15...

Truncate text to fit table cell without wrapping using css or jquery

I want the text in one of the columns of a table to not wrap, but to just truncate so that it fits within the current size of the table cell. I don't want the table cell to change size, as I need the table to be exactly 100% the width of the container. This is because the table with 100% width is inside of a positioned div with overflow...

What is more viable to use? Javascript libraries or UI Programming tools?

What is more viable to use:- Javascript Libraries: YUI, jQuery, ExtJs OR UI Programming tools: GWT, ExtGWT, SmartGWT It has become very difficult to choose between them as they are constantly increasing their capabilities to meet newer requirements. We all know the power of jQuery in UI manipulations. The latest news from Micro...

How to make this jquery function reusable?

Hai this is my jquery function, function getRecordspage(curPage, pagSize) { $.ajax({ type: "POST", url: "Default.aspx/GetRecords", data: "{'currentPage':" + curPage + ",'pagesize':" + pagSize + "}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(jso...

How to serialize as an array of objects from multiple fields in jQuery?

Hi, I'm using jQuery to dynamically add new divs containing a few fields. I'm adding new tunes in this example of output: <div id="uploadedTunes"> <div class="tune"> Title:<input type="text" name="Title"> Length:<input type="text" name="Length"> </div> <div class="tune"> Title:<input type="text" name="Title"> ...

Remove inner divs from a parent div using jquery...

Consider my parent div is parentDiv and it contains five child divs <div id="parentDiv"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> How to empty the child elements parentDiv using jquery.... EDIT: What is the diff between empty() and remove()? what should i use? ...