HighDots Forums  

how to pass value of var to jQuery

jQuery jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. jQuery is designed to change the way that you write JavaScript.


Discuss how to pass value of var to jQuery in the jQuery forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Cage
 
Posts: n/a

Default how to pass value of var to jQuery - 11-07-2009 , 12:10 PM






I've create a jQuery event for .addrow Button, once we click it, that
will add new row to the table, there are couple of formfield with
suggestbox will also clone within the same row. As the formfield
input id will also clone, how can I pass the identity to jQuery
jsonSuggest function, I can get all the value in next by String foods
[] = req.getParametervalues(foods)..... Please help, thank you very
much.

$(document).ready(function() {
$('#form1').validationEngine();
var newRowNum = 0;
$('.addRow').click(function(){
var $newTr = $('#tb1 tbody>tr:last').clone(true);
newRowNum +=
1; <==
counter of the rows
$newTr.find('input:even').attr('id', function(){
$('').jsonSuggest
( <==
this part
function(text, wildCard, caseSensitive, notCharacter) {
rez = $.ajax({
type: 'GET',
url: 'getFoodJSON.jsp',
data: 'foods=' + text,
dataType: 'json',
async: false
});
return eval(rez.responseText);
},
{ ajaxResults:true
});
});
$('input[id^=foods]', $newTr).val('');
$newTr.insertAfter('#tb1 tbody>tr:last');
});
});

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.