<button id=new_one name=button1>My Button</button>
<input type=button id=b1 value='Add'>
Most common requirment is Click event of a button.
<script>
$(document).ready(function() {
$('#new_one').click(function(){
alert('Hi , you clicked the button');
})
})
</script>
Create your own button by using Code generator
<button id=new_one1 class=my_button>My Button 1</button> <button id=new_one2 class=my_button>My Button 2</button> <button id=new_one3 class=my_button>My Button 3</button>
<script>
$(document).ready(function() {
$(".my_button").click(function(){
var str=this.id;
alert('Hi , you clicked one of the button with id= ' + str);
})
})
</script>
$("#b3").prop('disabled',true);
<button id=b1>Disable Button</button>
<button id=b2>Enable Button</button>
<button id=b3>My Button</button>
<script>
$(document).ready(function() {
$("#b1").click(function(){
$("#b3").prop('disabled',true);
})
$("#b2").click(function(){
$("#b3").prop('disabled',false);
})
})
</script>
alert($('#b3' ).prop( 'disabled' ));
Above code will return true or false based on the status of the button.
<button id=new_one12 class=my_button1 value='my_button_12'>My Button 12</button> <button id=new_one22 class=my_button1 value='my_button_22'>My Button 22</button> <button id=new_one32 class=my_button1 value='my_button_32'>My Button 32</button>
<script>
$(document).ready(function() {
$(".my_button1").click(function(){
var str=$(this).attr("value");
alert('You clicked one of the button with value = ' + str);
})
})
</script>
<input type='button' value='Click to Update' id='b_update'>
<button type='button' class='btn btn-warning' id=b_update2>Click to Change </button>
<script>
$(document).ready(function() {
$("#b_update").click(function(){
$("#b_update").prop('value', 'I am UPDATED');
})
$("#b_update2").click(function(){
$("#b_update2").html('I am CHANGED');
})
})
</script>
$("#b1_close_open").click(function(){
var str=$(this).attr("value");
if(str=='Close All'){
$("#b1_close_open").prop('value', 'Open All');
$("#b1_close_open").html('Open All');
//$( "#my_tabs" ).tabs( "option", "active", false );
}else{
$("#b1_close_open").prop('value', 'Close All');
$("#b1_close_open").html('Close All');
//$( "#my_tabs" ).tabs( "option", "active", true );
}
})
<button type='button' class='btn btn-default btn-md ' id='b1'>Dafault</button>
<button type='button' class='btn btn-lg ' id='b1'>Basic</button>
<button type='button' class='btn btn-primary' id='b1'>Primary</button>
<button type='button' class='btn btn-succcess' id='b1'>sucess</button>
<button type='button' class='btn btn-info' id='b1'>info</button>
<button type='button' class='btn btn-warning' id='b1'>warning</button>
<button type='button' class='btn btn-danger' id='b1'>danger</button>
<button type='button' class='btn btn-success btn-lg'>Large</button>
<button type='button' class='btn btn-info btn-lg btn-block'>Block level button</button>
Create your own button by using Code generator
Mohammd Naeem | 02-11-2017 |
How to create button in html/javascript/php which is appeared since 11:00am to 11:59pm everyday. |
smo1234 | 14-11-2017 |
You can use timer to read the time periodically and then manage to display or hide button. It is better to read clock from server side and set the duration as client clock can be changed. Trigger the reading of server clock by a timer and once it is 11.00 AM then show the button, hide the same after 59 minutes. Read the JavaScript clock and timer uses here JavaScript timer Read the how the server time can be collected |
Most Popular JQuery Scripts | |
1 | Two dependant list boxes |
2 | Calendar with Date Selection |
3 | Data change by Slider |
4 | Show & Hide element |