Understand. But my issue is a bit different which i think i could not make it clear. I have a js file associated with every aspx page. Now my code is like
<input type="text" id="myid" onclick="javascript:sayHello(<%= myValueFromServer%>);" /> I tried to use the code (which is in my .js file) as: <script type="text/javascript"> $(function() { //document.ready $("#myid").click(function() { alert( "Hello " + <%= myValueFromServer%> ); } }); But in .js file it does not resolve the <%%> value. Any help would be appreciated. On Sep 26, 2:13 pm, "Richard D. Worth" <[EMAIL PROTECTED]> wrote: > The same with jQuery looks like this: > > <input type="text" id="myid" value="World" /> > <script type="text/javascript"> > $(function() { //document.ready > > $("#myid").click(function() { > alert( "Hello " + $(this).val() ); > } > > }); > > </script> > > You don't have to pass anything to the function since the 'this' context > variable is equal to the element to which the event was bound. If you want > to pass some other value to the function, there are a couple of ways to do > that, but which one to pick would really depend on the what/why. In other > words, it's hard to say without a more real scenario. > > - Richard > > Richard D. Worthhttp://rdworth.org/ > > On Thu, Sep 25, 2008 at 11:22 PM, JQueryProgrammer <[EMAIL PROTECTED]>wrote: > > > > > 1. I have some simple queries with regards to function calling. In > > plain javascript if I want to call a javascript function from my HTMl > > tag i do it like: > > <input type="text" id="myid" onclick="javascript:sayHello(this.id);" > > value="World" /> > > Now my javascript function would be defined as > > function sayHello(id) { > > alert("Hello " + id.value); > > } > > > Now I want to use JQuery to do such kind of programming wherein some > > value (not necessary something from the attribute) is passed t o the > > function and processing is done. Can anyone please guide me as to how > > can it be acomplished.