up

javascript

jQuery link click href value

I've wrote these words on google. And I don't find the exact solution.

The problem:
What Should I write in the href? If I write # sign then browser go to the top of page. I wouldn't like to go to the top of page.

Here is the HTML:

<a href="#" id="example" >Click</a>

jQuery code:

How to generate dynamic javascript files with Ruby on Rails?

The problem

I want to write JavaScript files that use dynamic informations via Ruby on Rails. I think my solution also works with rails 2 and 3.
What can dynamic JavaScript do for you? You can write JavaScript on your ERB (embedded ruby) file beside HTML code. This is very simple, but not the best solution for a longer jQuery script.
For example:
Translation in JavaScript: translation with I18n.t() Rails method would be great in separated JavaScript file with ERB capability.

// some jquery code before alert
alert();