Michael Keck a écrit :
Hi Marc,
On Sat, 11 Sep 2010 08:37:59 -0400, Marc Delisle marc@infomarc.info wrote:
Hi, this works on a input element:
var this_name = $(this).attr('name');
so I'm trying to do the same to extract the code inside the onchange "attribute":
var this_onchange = $(this).attr('onchange');
this won't work.
but Firebug tells me that this_onchange is an event;
yepp that's right
it does not contain the code. I need to do subsequent string matching and replacement in this code.
Please use a function call for this, and replace silly the params: $(this).unbind('change');
Michael, I also need to do .attr('onchange', '')
otherwise the code inside onchange executes.
$(this).bind('change', function(e) { // your function call // something like: // pma_js_function_to_call(param1, param2, para,X) });