tags:

views:

39

answers:

1

I have the following at html code

<a class="toolbar" onclick="javascript: submitbutton('items')" href="#">

Now i want that in jquery i convert it to

 <a class="toolbar" href="javascript:history.go(-1)">

Any ideas

+4  A: 

Do you mean like that?

$('.toolbar').removeAttr('onclick').attr('href','javascript:history.go(-1)');
Kai
thanks buddy , it worked , what will i do without u guys :)
Mirage
Look up documentation? Search through SO first before posing a question? Searching for something like 'remove attribute jquery' reveals may hits on SO and Google that match your question. http://www.google.com/search?q=remove+attribute+jquery http://stackoverflow.com/search?q=remove+attribute+jquery
Nitrodist
Also, you don't need the "javascript:" in there. onclick will work just fine without it.
Bill Turner
ACtually i didn't knew that onclick was attribute , i thought it was event so i was looking for removing event
Mirage