Dear all
I am newbie to jQuery and loves it
Can any one give me a small jQuery code snippet to Show an alert/Div when a button (with id btnSave ) being clicked .
Dear all
I am newbie to jQuery and loves it
Can any one give me a small jQuery code snippet to Show an alert/Div when a button (with id btnSave ) being clicked .
You should do something like this:
<div id='alert'>ALERT!</div>
$('#btnSave').click( function() {
$('#alert').show();
});
$(function() {
$("#btnSave").click(function() {
alert("Alert");
});
});
or
<div id="alert">
<p>Some alert.</p>
<input type="button" id="ok" value="OK">
</div>
with:
$(function() {
$("#btnSave").click(function() {
$("#alert").show();
});
$("#ok").click(function() {
$("#alert").hide();
});
});
Note: I wouldn't actually do it that way. Instead I'd use an existing plug-in like jQuery UI dialog.