KiPiPo.com blog gadget design wallpaper web programming review

20Aug/120

check checkbox with specific value ( using jQuery )

To check/uncheck checkbox with specific value using jQuery.

To check checkbox with id lead with "chk_hobby_" and has value = 7 :

$("#data-form input[id^='chk_hobby_'][value=7]").prop('checked',true);

To uncheck checkbox with id lead with "chk_hobby_" and has value = 2 :

$("#data-form input[id^='chk_hobby_'][value=2]").prop('checked',false);

HTML Sample :

<form id="data-form">Hobby
<div><input id="chk_hobby_2" type="checkbox" name="hobby[]" value="2" checked="true" /> <label>Swimming</label></div>
<div><input id="chk_hobby_6" type="checkbox" name="hobby[]" value="6" /> <label>Watching Movie</label></div>
<div><input id="chk_hobby_7" type="checkbox" name="hobby[]" value="7" /> <label>Bowling</label></div>
</form>
Demo :
http://jsfiddle.net/B6Jks/
Tagged as: No Comments
24Jul/120

Javascript UI library

Here some javascript library for make your website user interface (UI) looks good and cut your time to create common UI.
They have many common feature which is we need for common website, datagrid, tree, window, menu, accordion, datepicker, etc .
jQuery UI
http://jqueryui.com

jQuery EasyUI
This library is created  based on jQuery.
http://www.jeasyui.com

jqWidgets
This library is created  based on jQuery and also support for mobile device.
http://www.jqwidgets.com

12Feb/110

basic jquery tutorial

What is jquery ? jquery is one of most popular javascript library to make your live easier 😀 , you can make animation, ajax, manipulate html with only few line code. You can download jquery file from www.jquery.com . Here same sample jquery for basic usage :)  .

Hello World

//make sure you use ready state to make sure all element is loaded before execute the script inside
$(document).ready(function(){
 alert("Hello World");
});

Full code :

<html>
 <head>
    <title>Untitled Document</title>
 </head>
<body>
  <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
  <script type="text/javascript">
     $(document).ready(function(){
        alert("Hello World");
     });
 </script>
</body>
</html>