Showing posts with label JQUERY. Show all posts
Showing posts with label JQUERY. Show all posts

Friday, November 16, 2012

how to find div ID on click using jquery

how to find div ID on click using jquery

Solution:
 <script>
var coutnet=0;
 function creatediv() {
        
           counter = counter + 1;
  var x = $("<div class='droppable'  id='D" + counter + "' onclick='findid(this)'> </div>");
             $("div#maindiv").append(x);

function findid(el) {
             var idss=   $(el).attr('id');
             alert(idss);
              

            }

</script>

<h2>

 html code

<input onclick="creatediv()" type="button" value="createnewdiv" />
<br />
 

how to find image id on click using jquery



html code


<img class="droppableimg" id="xyz" onclick="findid(this)" />



javascript

<script type="text/javascript">
function findid(el) {
             var idss=   $(el).attr('id');
             alert(idss);
              

            }
</script>

JQUERY SWITCH CASE STATMENT

JQUERY SWITCH CASE STATMENT

solution


 <script type="text/javascript">
 switch (itemid) {
                        case '1': alert(itemid); break;
                        case '2': alert(itemid); break;
                        case '3': alert(itemid); break;
                        case '4': alert(itemid); break;
                    }
  </script>

 

Tuesday, November 6, 2012

jquery datepicker with month and year

jquery datepicker with month and year

SOLUTION:






    <title>jQuery UI Datepicker - Default functionality</title>
    <link href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" rel="stylesheet"></link>
    <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
    <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
    <link href="/resources/demos/style.css" rel="stylesheet"></link>
    <script>
   <script type="text/javascript" id="Datepicker">
    $(function () {
        $("#SchedDate").datepicker({ changeMonth: true, changeYear: true,dateFormat:'mm/dd/yy',showMonthAfterYear: true });
        $("#StatDate").datepicker({ changeMonth: true, changeYear: true, dateFormat: 'mm/dd/yy', showMonthAfterYear: true });
        $("#compDate").datepicker({ changeMonth: true, changeYear: true, dateFormat: 'mm/dd/yy', showMonthAfterYear: true });
       
  

    });
</script>



Date: <input id="SchedDate" type="text" />


Date: <input id="StatDate" type="text" />


Date: <input id="compDate" type="text" />

 

Monday, November 5, 2012

Get Selected Value From Dropdownlist Using Jquery

Get Selected Value From Dropdownlist 

 Solution: