-3

Possible Duplicate:
How to convert Javascript code to Jquery code?

I need to convert this javascript code to Jquery?

eval("document.forms[0].strKey" + intDimId).value + "," + tarr[i];

Can you please help me how to change the above code to jQuery

Thanks,

Rajasekhar.

1
  • Eval is Evil. Use it only when you dont have any option Commented Jun 8, 2012 at 7:01

1 Answer 1

2

One word: DON'T.

If you have working JavaScript, "converting" it to jQuery is a DOWNGRADE.

But you really should learn about arrays. Seriously, just rewrite your code as:

document.forms[0]['strKey'+intDimId].value + "," + tarr[i];
Sign up to request clarification or add additional context in comments.

5 Comments

How is using jQuery instead of plain JS a downgrade?
@lanzz jQuery is ultimately "converted" to javascript. Hence, it's a downgrade. jQuery is used mainly 'coz it saves you a lot of time.
@lanzz jQuery is a higher "language" than JavaScript. JavaScript is already a high-level, interpreted language. Adding yet another layer is just daft, in my opinion.
So you don't believe there are any benefits in using libraries in any language? And you find an inherent benefit in directly supporting quirks and bugs in a large bunch of incompatible browsers?
@lanzz my comment was in response to this answer, that changing one line of code from javascript to jQuery is a downgrade, which I believe it is.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.