Using function .when jQuery in "Javascript"

Mario

I am new to jQuery $.When. I am trying to fill a textbox after another textbox be filling

<script>
         var search;
         $.when( search= $("#newhiddenfield").val()).then(myFunc(search)) 

            (function teste(search) {                
                $('.gsc-input').val(search);
                $('.gsc-search-button').click();
            })();  

</script>
Mifeng

$.when in jquery works with jquery's Deferred object (for async behavior).

In your case, DOM operations does not require when. You can just write:

var search = $("#newhiddenfield").val();

$('.gsc-input').val(search);
$('.gsc-search-button').click();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

jQuery is not a function when using .has()

Jquery unexpected token when using a function

jQuery function not hooked when using .on event

jquery this.each is not function when using .val

Pass parameter to jquery function when using class

Issues Using Deferred/When in jquery to defer a function

Pass params to function when using on() in jquery

Call angularjs function using jquery/javascript

Using a selector "$(this).find()" jQuery inside a javascript function

Return from a javascript function when using NEW

Calling a function when using setTimeout() and setInterval() in JavaScript

Param placeholder when using javascript bind function

Errors when using/defining function in JavaScript

Syntax Error when writing a function using "this" on JavaScript

Django - SyntaxError when using {{ }} and {% %} tags in javascript function

Javascript this.u undefined when using in function

Error question when using recursive function in JavaScript

Run javascript function when enter is pressed - JavaScript only no Jquery

Run Javascript function when jquery mobile page loads

How To Call A Javascript Function From Inside Jquery When An ID is Clicked

Using jQuery .when, How to pass in variable number of function calls?

Calling a parent jQuery function from an iframe when using PhoneGap

jQuery element.closest(...).attr is not a function when using each

How to load function when open page using jquery?

jquery function stops working when changing page using Kaminari

JQuery/AJAX & PHP - Error with isset() when using .load() function

Stay within DIV when using a JQuery mousemove function

Submit function executing multiple times when using jQuery

jQuery "Uncaught TypeError: undefined is not a function" when using fadeIn();