GessWurker
asked on
use javascript to assign new href to button in .net app
I'm working with a .net app and I need to re-assign the href attribute in a button. I can't mess with the .net code, but I can add all the javascript I want. However, so far I've had no luck.
Here's the button:
<a name="ctl00$ctl00$btnSubmi t" language="javascript" href="javascript:{ClickOnc e_ctl00_ct l00_btnSub mit();}" id="ctl00_ctl00_btnSubmit" style="float:left;">Save</ a>
Here's how I'm trying to assign something new to href:
<script language="javascript">
$(document).ready(function () {
$("#ctl00_ctl00_btnSubmit" ).href="ja vascript:{ alert('You clicked save!');}"
}
</script>
But nothing doing. Doesn't work. Can somebody help? Is there another method?
Here's the button:
<a name="ctl00$ctl00$btnSubmi
Here's how I'm trying to assign something new to href:
<script language="javascript">
$(document).ready(function
$("#ctl00_ctl00_btnSubmit"
}
</script>
But nothing doing. Doesn't work. Can somebody help? Is there another method?
if that doesn't work, then you can change the href like this:
$("#ctl00_ctl00_btnSubmit" ).attr("hr ef", "javascript:{alert('You clicked save!") )
$("#ctl00_ctl00_btnSubmit"
ASKER
Hi Big Monty.
Neither option worked. No alert.
Neither option worked. No alert.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Excellent. Works!
Thanks!
Thanks!
<script language="javascript">
$(document).ready(function
$('#ctl00_ctl00_btnSubmit'
alert('You clicked save!');
});
}
</script>