Skip to content Skip to sidebar Skip to footer

How To Convert Javascript Code To Jquery Code?

Please help me, here is the code in Javascript, I need to change this code to Jquery. eval('parent.document.forms[0].strKey' + intDimensionId).value = strIds[intDimensionId]

Solution 1:

high performance: minimal jQuery: $('form:first')[0]["strKey" + intDimensionId].value = strIds[intDimensionId];

not as high performance: full jQuery: $('form:first *[name="strKey' + intDimensionId + '"]').val(strIds[intDimensionId]);

Solution 2:

This should work although there are really plenty of ways to do this. Also note the use of the input tag. Your code may use a different tag so update accordingly.

$('input[name=strKey'+intDimensionId+']',
   parent.document.forms[0]).val(strIds[intDimensionId]);

Post a Comment for "How To Convert Javascript Code To Jquery Code?"