¡@

Home 

2014/10/16 ¤W¤È 12:01:55

jquery Programming Glossary: answer

Convert form data to JS object with jQuery

http://stackoverflow.com/questions/1184624/convert-form-data-to-js-object-with-jquery

event.preventDefault() vs. return false

http://stackoverflow.com/questions/1357118/event-preventdefault-vs-return-false

Why does jQuery or a DOM method such as `getElementById` not find the element?

http://stackoverflow.com/questions/14028959/why-does-jquery-or-a-dom-method-such-as-getelementbyid-not-find-the-element

are looking for do not exist. For the remainder of this answer I will use getElementById as example but the same applies to..

jQuery Mobile: document ready vs page events

http://stackoverflow.com/questions/14468659/jquery-mobile-document-ready-vs-page-events

How do I “think in AngularJS” if I have a jQuery background?

http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background

Here are a few questions that might help you frame an answer How do I architect and design client side web applications differently.. operating on it she doesn't need to intuit the right answer or sift through any code. The view told us what was supposed.. of concerns and introduces far greater testability. Other answers mentioned this point so I'll just leave it at that. Separation..

How can I upload files asynchronously with jQuery?

http://stackoverflow.com/questions/166221/how-can-i-upload-files-asynchronously-with-jquery

Event binding on dynamically created elements?

http://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements

jQuery AJAX cross domain

http://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain

XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin

http://stackoverflow.com/questions/3595515/xmlhttprequest-error-origin-null-is-not-allowed-by-access-control-allow-origin

jQuery/JavaScript: accessing contents of an iframe

http://stackoverflow.com/questions/364952/jquery-javascript-accessing-contents-of-an-iframe

Abort Ajax requests using jQuery

http://stackoverflow.com/questions/446594/abort-ajax-requests-using-jquery

Preloading images with jQuery

http://stackoverflow.com/questions/476679/preloading-images-with-jquery

How can I make a redirect page in jQuery/JavaScript?

http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-in-jquery-javascript

.prop() vs .attr()

http://stackoverflow.com/questions/5874652/prop-vs-attr

improve this question Update 1 November 2012 My original answer applies specifically to jQuery 1.6. My advice remains the same.. disagree with his recommendation to prefer attr . Original answer If you've only ever used jQuery and not the DOM directly this..

How can I get query string values in JavaScript?

http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript

pushState() and popState(): manipulating browsers' history

http://stackoverflow.com/questions/10632483/pushstate-and-popstate-manipulating-browsers-history

history.js popstate share improve this question Answer 1 Get the title working when going forward and backward As far.. out of the html but not removing there child elements. Answer 2 Optimize the load time of the mainpage A document is getting.. was cached and the document was loading very fast. Answer 3 Fix the active class when going forward and backward I would..

How can I duplicate Pinterest website's modal effect? [closed]

http://stackoverflow.com/questions/11252579/how-can-i-duplicate-pinterest-websites-modal-effect

as duplicating the Pinterest Webpage Layout see this SO Answer . To use custom Pinterest Button that is text link thumbnail.. that is text link thumbnail or combo of both see this SO Answer . For Data Scrape Pinterest process with jsFiddle tutorial see..

jQuery - drag div css background

http://stackoverflow.com/questions/11271704/jquery-drag-div-css-background

reset http jsfiddle.net userdude q6r8f 4 Original Answer HTML div class bg img div CSS div.bg img background image url..

How to retrieve query string parameter and values using javascript (Jquery)?

http://stackoverflow.com/questions/1171713/how-to-retrieve-query-string-parameter-and-values-using-javascript-jquery

it document.write querySt id document.write querySt status Answer to your 'update' http ilovethecode.com Javascript Javascript..

Show/ Hide Table Column with colspan using jQuery

http://stackoverflow.com/questions/12455699/show-hide-table-column-with-colspan-using-jquery

Lijo auny3 11 http jsfiddle.net Lijo auny3 13 Selected Answer http jsfiddle.net Lijo UqdQp 2 jquery html css share improve..

Latest jQuery version on Google's CDN

http://stackoverflow.com/questions/12608242/latest-jquery-version-on-googles-cdn

browser make sure it's getting the latest version today Answer no caching. In fact here's a breakdown of several options and..

jQuery select box validation

http://stackoverflow.com/questions/14896854/jquery-select-box-validation

select Working Demo http jsfiddle.net tPRNd Original Answer Only if you can set value within the first option To properly..

How to tell if browser/tab is active [duplicate]

http://stackoverflow.com/questions/1760250/how-to-tell-if-browser-tab-is-active

.blur function clearInterval interval_id interval_id 0 To Answer the Commented Issue of Double Fire and stay within jQuery ease..

jQuery event handlers always execute in order they were bound - any way around this?

http://stackoverflow.com/questions/2360655/jquery-event-handlers-always-execute-in-order-they-were-bound-any-way-around-t

in jQuery jquery share improve this question Updated Answer jQuery changed the location of where events are stored in 1.8... 0 0 handler And here's a playground . Original Answer As @Sean has discovered jQuery exposes all event handlers through..

Produce “toast” messages like StackOverflow

http://stackoverflow.com/questions/4237636/produce-toast-messages-like-stackoverflow

Well one method to use jGrowl to expand on Shane's Answer via .cs is shown below. This example in webform ASP.NET Create..

jQuery - How to get all styles/css (defined within internal/external document) with HTML of an element

http://stackoverflow.com/questions/4781410/jquery-how-to-get-all-styles-css-defined-within-internal-external-document-w

span class someClass Some innerText span div UPDATE 3 for Answer by kirilloid I ran below code in Command Window of Chrome Debugger..

jQuery - Click event doesn't work on dynamically generated elements

http://stackoverflow.com/questions/6658752/jquery-click-event-doesnt-work-on-dynamically-generated-elements

to the previous answer below. jsFiddle using on Previous Answer Try using live button .click function h2 .html p class 'test'..

Trouble with jQuery Dialog and Datepicker plugins

http://stackoverflow.com/questions/715677/trouble-with-jquery-dialog-and-datepicker-plugins

jquery ui dialog share improve this question Old Answer z index note the hyphen is the property that matters. Make sure..

Detect IF hovering over element with jQuery

http://stackoverflow.com/questions/8981463/detect-if-hovering-over-element-with-jquery

share improve this question Original And Correct Answer You can use is and check for the selector hover . var isHovered..

Selecting text on focus using jQuery not working in iPhone iPad Browsers

http://stackoverflow.com/questions/9924506/selecting-text-on-focus-using-jquery-not-working-in-iphone-ipad-browsers

mobile mobile website share improve this question Answer found here don't know how to mark this question as duplicate...

Limit Bootstrap Datepicker to weekdays only?

http://stackoverflow.com/questions/10234153/limit-bootstrap-datepicker-to-weekdays-only

a daysOfWeekDisabled option. See @fin's answer below. OLD ANSWER Here is a working demo Assuming your weeks starts on sunday..

jqPlot : how to color parts of background / grid with several different colors

http://stackoverflow.com/questions/10837997/jqplot-how-to-color-parts-of-background-grid-with-several-different-colors

Or anyone would have another idea Thanks EDIT WITH FINAL ANSWER Based on the Boro's suggestion I developed a better way to highlight..

jQuery ajax:error runs even if the response is OK 200

http://stackoverflow.com/questions/10839771/jquery-ajaxerror-runs-even-if-the-response-is-ok-200

which seems all good email zxxczxc@test.com ANSWER I managed to have everything work when I put 'data type' json..

jQuery Mobile Tabs and Anchors

http://stackoverflow.com/questions/12181586/jquery-mobile-tabs-and-anchors

work you have to have a built in div with ID jib UPDATED ANSWER AFTER COMMENTS What you're looking for is .mobile.silentScroll..

resume webapp from previous position?

http://stackoverflow.com/questions/12816286/resume-webapp-from-previous-position

'http www.example.com products bicycles' time 86400 ' ' ANSWER On your homepage before displaying any content check with PHP..

How to associate marks for each answer button

http://stackoverflow.com/questions/14866099/how-to-associate-marks-for-each-answer-button

arrQuestionNo key . strong p BELOW DISPLAYS THE ANSWER BUTTONS FOR EACH QUESTION options explode ' ' arrOptionType.. answers div class queWrap QUESTION 1 p strong 1 strong p ANSWER BUTTONS FOR QUESTION 1 div class ck button label class fixedLabelCheckbox.. p div div class queWrap QUESTION 2 p strong 2 strong p ANSWER BUTTONS FOR QUESTION 2 div class ck button label class fixedLabelCheckbox..

page loaded differently with jQuery-mobile transition

http://stackoverflow.com/questions/15430912/page-loaded-differently-with-jquery-mobile-transition

file. If you want to find out more take a look at my other ANSWER with several other solutions or find it HERE . Example 1 Correct..

Is there more than one jQuery Autocomplete widget?

http://stackoverflow.com/questions/2421966/is-there-more-than-one-jquery-autocomplete-widget

jquery autocomplete share improve this question ANSWER There are numerous autocomplete widgets that work with jQuery...

Find out how long an Ajax request took to complete

http://stackoverflow.com/questions/3498503/find-out-how-long-an-ajax-request-took-to-complete

information and then display it on the page somewhere. ANSWER I'm new to javascript this is the best that I could come up..

Retrieve Button value with jQuery

http://stackoverflow.com/questions/487056/retrieve-button-value-with-jquery

Or should I be using a different approach Many thanks. ANSWER I'm now using input class my_button type image src whatever.png..

Avoid createElement function if it's inside a <LI> element (contentEditable)

http://stackoverflow.com/questions/6024594/avoid-createelement-function-if-its-inside-a-li-element-contenteditable

not to work if I'm inside a LI element EDIT WITH MY ANSWER Ok I've managed to do it but If you have any comment on the..

Anyone have ideas for solving the “n items remaining” problem on Internet Explorer?

http://stackoverflow.com/questions/734824/anyone-have-ideas-for-solving-the-n-items-remaining-problem-on-internet-explor

divide out unless I absolutely have to . FINAL UPDATE AND ANSWER There were a lot of good answers and suggestions below but none..

$(this).hide() not working on option elements in IE8

http://stackoverflow.com/questions/9481563/this-hide-not-working-on-option-elements-in-ie8

and IE8 Please help me to get rid of it. Thanks in advance ANSWER given by Paulo Rodrigues js code var original '#group_dd' .clone..

Convert form data to JS object with jQuery

http://stackoverflow.com/questions/1184624/convert-form-data-to-js-object-with-jquery

event.preventDefault() vs. return false

http://stackoverflow.com/questions/1357118/event-preventdefault-vs-return-false

Why does jQuery or a DOM method such as `getElementById` not find the element?

http://stackoverflow.com/questions/14028959/why-does-jquery-or-a-dom-method-such-as-getelementbyid-not-find-the-element

this question Short and simple Because the elements you are looking for do not exist. For the remainder of this answer I will use getElementById as example but the same applies to getElementsByTagName querySelector and any other DOM method..

jQuery Mobile: document ready vs page events

http://stackoverflow.com/questions/14468659/jquery-mobile-document-ready-vs-page-events

How do I “think in AngularJS” if I have a jQuery background?

http://stackoverflow.com/questions/14994391/how-do-i-think-in-angularjs-if-i-have-a-jquery-background

AngularJS. Can you describe the paradigm shift that is necessary Here are a few questions that might help you frame an answer How do I architect and design client side web applications differently What is the biggest difference What should I stop.. this and then know that there is a directive called dropdownMenu operating on it she doesn't need to intuit the right answer or sift through any code. The view told us what was supposed to happen. Much cleaner. Developers new to AngularJS often.. This helps for the above data binding maintains separation of concerns and introduces far greater testability. Other answers mentioned this point so I'll just leave it at that. Separation of concerns And all of the above tie into this over arching..

How can I upload files asynchronously with jQuery?

http://stackoverflow.com/questions/166221/how-can-i-upload-files-asynchronously-with-jquery

Event binding on dynamically created elements?

http://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements

jQuery AJAX cross domain

http://stackoverflow.com/questions/3506208/jquery-ajax-cross-domain

XmlHttpRequest error: Origin null is not allowed by Access-Control-Allow-Origin

http://stackoverflow.com/questions/3595515/xmlhttprequest-error-origin-null-is-not-allowed-by-access-control-allow-origin

jQuery/JavaScript: accessing contents of an iframe

http://stackoverflow.com/questions/364952/jquery-javascript-accessing-contents-of-an-iframe

Abort Ajax requests using jQuery

http://stackoverflow.com/questions/446594/abort-ajax-requests-using-jquery

Preloading images with jQuery

http://stackoverflow.com/questions/476679/preloading-images-with-jquery

How can I make a redirect page in jQuery/JavaScript?

http://stackoverflow.com/questions/503093/how-can-i-make-a-redirect-page-in-jquery-javascript

.prop() vs .attr()

http://stackoverflow.com/questions/5874652/prop-vs-attr

in the future javascript jquery dom attr prop share improve this question Update 1 November 2012 My original answer applies specifically to jQuery 1.6. My advice remains the same but jQuery 1.6.1 changed things slightly in the face of the.. about it . I can see the difficulty they were in but still disagree with his recommendation to prefer attr . Original answer If you've only ever used jQuery and not the DOM directly this could be a confusing change although it is definitely an improvement..

How can I get query string values in JavaScript?

http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values-in-javascript

pushState() and popState(): manipulating browsers' history

http://stackoverflow.com/questions/10632483/pushstate-and-popstate-manipulating-browsers-history

she who can answer all of my questions 3 jquery html5 pushstate history.js popstate share improve this question Answer 1 Get the title working when going forward and backward As far as I understood you want to change the document title html.. is because jQuery is kind of parsing html head and body tags out of the html but not removing there child elements. Answer 2 Optimize the load time of the mainpage A document is getting loaded from to top to the bottom. So first of all the css.. BtW I just had this problem at the first time after that everything was cached and the document was loading very fast. Answer 3 Fix the active class when going forward and backward I would say loop trough the href attributes of the a elements and..

How can I duplicate Pinterest website's modal effect? [closed]

http://stackoverflow.com/questions/11252579/how-can-i-duplicate-pinterest-websites-modal-effect

to Pinterest and you have a decent clone method to use. As far as duplicating the Pinterest Webpage Layout see this SO Answer . To use custom Pinterest Button that is text link thumbnail or combo of both see this SO Answer . For Data Scrape Pinterest..

jQuery - drag div css background

http://stackoverflow.com/questions/11271704/jquery-drag-div-css-background

0' bg.bind 'mousedown mouseup mouseleave' handle bg.bind 'dblclick' reset http jsfiddle.net userdude q6r8f 4 Original Answer HTML div class bg img div CSS div.bg img background image url http upload.wikimedia.org wikipedia commons 9 91 Flexopecten_ponticus_2008_G1.jpg..

How to retrieve query string parameter and values using javascript (Jquery)?

http://stackoverflow.com/questions/1171713/how-to-retrieve-query-string-parameter-and-values-using-javascript-jquery

gy.length i ft gy i .split if ft 0 ji return ft 1 To use it document.write querySt id document.write querySt status Answer to your 'update' http ilovethecode.com Javascript Javascript Tutorials How_To Easy Get_Query_String_Using_Javascript.shtml..

Show/ Hide Table Column with colspan using jQuery

http://stackoverflow.com/questions/12455699/show-hide-table-column-with-colspan-using-jquery

Lijo auny3 8 http jsfiddle.net Lijo auny3 12 http jsfiddle.net Lijo auny3 11 http jsfiddle.net Lijo auny3 13 Selected Answer http jsfiddle.net Lijo UqdQp 2 jquery html css share improve this question Hi now used to this Jquery document .ready..

Latest jQuery version on Google's CDN

http://stackoverflow.com/questions/12608242/latest-jquery-version-on-googles-cdn

points to 1.7.1 one day and 1.7.2 the next day. How will the browser make sure it's getting the latest version today Answer no caching. In fact here's a breakdown of several options and their expiration settings... http code.jquery.com jquery latest.min.js..

jQuery select box validation

http://stackoverflow.com/questions/14896854/jquery-select-box-validation

Year option option value 1 1955 option option value 2 1956 option select Working Demo http jsfiddle.net tPRNd Original Answer Only if you can set value within the first option To properly validate a select element with the jQuery Validate plugin..

How to tell if browser/tab is active [duplicate]

http://stackoverflow.com/questions/1760250/how-to-tell-if-browser-tab-is-active

if interval_id interval_id setInterval hard_work 1000 window .blur function clearInterval interval_id interval_id 0 To Answer the Commented Issue of Double Fire and stay within jQuery ease of use window .on blur focus function e var prevType this..

jQuery event handlers always execute in order they were bound - any way around this?

http://stackoverflow.com/questions/2360655/jquery-event-handlers-always-execute-in-order-they-were-bound-any-way-around-t

existing events. So what is the best way to achieve this in jQuery jquery share improve this question Updated Answer jQuery changed the location of where events are stored in 1.8. Now you know why it is such a bad idea to mess around with.. end var handler handlers.pop move it at the beginning handlers.splice 0 0 handler And here's a playground . Original Answer As @Sean has discovered jQuery exposes all event handlers through an element's data interface. Specifically element.data..

Produce “toast” messages like StackOverflow

http://stackoverflow.com/questions/4237636/produce-toast-messages-like-stackoverflow

.net asp.net jquery ajax messagebox share improve this question Well one method to use jGrowl to expand on Shane's Answer via .cs is shown below. This example in webform ASP.NET Create a simple aspx page with 1 button and make sure you include..

jQuery - How to get all styles/css (defined within internal/external document) with HTML of an element

http://stackoverflow.com/questions/4781410/jquery-how-to-get-all-styles-css-defined-within-internal-external-document-w

130 width 660px .someClass color blue style div id divId span class someClass Some innerText span div UPDATE 3 for Answer by kirilloid I ran below code in Command Window of Chrome Debugger tools for this page itself and this is what I see TypeError..

jQuery - Click event doesn't work on dynamically generated elements

http://stackoverflow.com/questions/6658752/jquery-click-event-doesnt-work-on-dynamically-generated-elements

jQuery version 1.7 . If you're using an older version refer to the previous answer below. jsFiddle using on Previous Answer Try using live button .click function h2 .html p class 'test' click me p .test .live 'click' function alert 'you clicked..

Trouble with jQuery Dialog and Datepicker plugins

http://stackoverflow.com/questions/715677/trouble-with-jquery-dialog-and-datepicker-plugins

stack bgiframe but not success. Someone can help me Tks. jquery jquery ui dialog share improve this question Old Answer z index note the hyphen is the property that matters. Make sure you set it greater than the dialogue and make sure you set..

Detect IF hovering over element with jQuery

http://stackoverflow.com/questions/8981463/detect-if-hovering-over-element-with-jquery

there a jQuery method that accomplishes this javascript jquery share improve this question Original And Correct Answer You can use is and check for the selector hover . var isHovered '#elem' .is hover returns true or false Example http jsfiddle.net..

Selecting text on focus using jQuery not working in iPhone iPad Browsers

http://stackoverflow.com/questions/9924506/selecting-text-on-focus-using-jquery-not-working-in-iphone-ipad-browsers

jQuery not working in Safari and Chrome jquery html jquery mobile mobile website share improve this question Answer found here don't know how to mark this question as duplicate. Programmatically selecting text in an input field on iOS devices..

Limit Bootstrap Datepicker to weekdays only?

http://stackoverflow.com/questions/10234153/limit-bootstrap-datepicker-to-weekdays-only

improve this question UPDATE Bootstrap datepicker now has a daysOfWeekDisabled option. See @fin's answer below. OLD ANSWER Here is a working demo Assuming your weeks starts on sunday function function disableWeekends this var days this.find '.datepicker..

jqPlot : how to color parts of background / grid with several different colors

http://stackoverflow.com/questions/10837997/jqplot-how-to-color-parts-of-background-grid-with-several-different-colors

grid by changing the background grid color if it is possible. Or anyone would have another idea Thanks EDIT WITH FINAL ANSWER Based on the Boro's suggestion I developed a better way to highlight a part of the background using the line option instead..

jQuery ajax:error runs even if the response is OK 200

http://stackoverflow.com/questions/10839771/jquery-ajaxerror-runs-even-if-the-response-is-ok-200

this is the JSON I am getting back from the server data.responseText which seems all good email zxxczxc@test.com ANSWER I managed to have everything work when I put 'data type' json in the form options. I tried this before and it did not work..

jQuery Mobile Tabs and Anchors

http://stackoverflow.com/questions/12181586/jquery-mobile-tabs-and-anchors

an anchor to. So in order for your internal a href #jib to work you have to have a built in div with ID jib UPDATED ANSWER AFTER COMMENTS What you're looking for is .mobile.silentScroll . You want to get your anchor link's Y position and then..

resume webapp from previous position?

http://stackoverflow.com/questions/12816286/resume-webapp-from-previous-position

cookie for 24 hrs for your domain setcookie 'lastPage' 'http www.example.com products bicycles' time 86400 ' ' ANSWER On your homepage before displaying any content check with PHP or language of choice if _COOKIE 'lastPage' is set. If it..

How to associate marks for each answer button

http://stackoverflow.com/questions/14866099/how-to-associate-marks-for-each-answer-button

queWrap LOOP THROUGH EACH QUESTION p php echo strong .htmlspecialchars arrQuestionNo key . strong p BELOW DISPLAYS THE ANSWER BUTTONS FOR EACH QUESTION options explode ' ' arrOptionType key if count options 1 start array_shift options end array_shift.. php Below is Source Code which displays 2 questions and their answers div class queWrap QUESTION 1 p strong 1 strong p ANSWER BUTTONS FOR QUESTION 1 div class ck button label class fixedLabelCheckbox input type checkbox name options_ php echo key.. type 'text' class 'questionIds' name 'questionids' value '72' p div div class queWrap QUESTION 2 p strong 2 strong p ANSWER BUTTONS FOR QUESTION 2 div class ck button label class fixedLabelCheckbox input type checkbox name options_ php echo key..

page loaded differently with jQuery-mobile transition

http://stackoverflow.com/questions/15430912/page-loaded-differently-with-jquery-mobile-transition

if you initialize all of your js fils inside a first HTML file. If you want to find out more take a look at my other ANSWER with several other solutions or find it HERE . Example 1 Correct way HTML 1 DOCTYPE html html head title jQM Complex Demo..

Is there more than one jQuery Autocomplete widget?

http://stackoverflow.com/questions/2421966/is-there-more-than-one-jquery-autocomplete-widget

I assume THE jquery UI autocomplete jquery jquery ui autocomplete jquery autocomplete share improve this question ANSWER There are numerous autocomplete widgets that work with jQuery. There is ONLY ONE that belongs to jQuery UI. http docs.jquery.com..

Find out how long an Ajax request took to complete

http://stackoverflow.com/questions/3498503/find-out-how-long-an-ajax-request-took-to-complete

long a particular .ajax request took I would like to get this information and then display it on the page somewhere. ANSWER I'm new to javascript this is the best that I could come up with if you don't want to inline the success function because..

Retrieve Button value with jQuery

http://stackoverflow.com/questions/487056/retrieve-button-value-with-jquery

What jQuery should I use to always get the button's value Or should I be using a different approach Many thanks. ANSWER I'm now using input class my_button type image src whatever.png value buttonValue jquery share improve this question..

Avoid createElement function if it's inside a <LI> element (contentEditable)

http://stackoverflow.com/questions/6024594/avoid-createelement-function-if-its-inside-a-li-element-contenteditable

whit the list... How could I create a condition for that function not to work if I'm inside a LI element EDIT WITH MY ANSWER Ok I've managed to do it but If you have any comment on the code you're welcome #form_description .live keypress function..

Anyone have ideas for solving the “n items remaining” problem on Internet Explorer?

http://stackoverflow.com/questions/734824/anyone-have-ideas-for-solving-the-n-items-remaining-problem-on-internet-explor

running in the document .ready though it's too hairy to divide out unless I absolutely have to . FINAL UPDATE AND ANSWER There were a lot of good answers and suggestions below but none of them were exactly our problem. The closest one and the..

$(this).hide() not working on option elements in IE8

http://stackoverflow.com/questions/9481563/this-hide-not-working-on-option-elements-in-ie8

FF but not working in IE7 IE8 . .hide is not working in IE7 and IE8 Please help me to get rid of it. Thanks in advance ANSWER given by Paulo Rodrigues js code var original '#group_dd' .clone '#comp_dd' .change function var parent this .val '#group_dd'..