Tuesday, October 21, 2014

how to work with change event with in click events using jquery

Posted by Unknown  |  No comments


 if you want more related search please click here  
 please help to other  
 http://scriptquery.blogspot.in/  

 how to work with change with in click events  
 <form>  
 <input class="target" type="text" value="Field 1">  
 <select class="target">  
 <option value="option1" selected="selected">Option 1</option>  
 <option value="option2">Option 2</option>  
 </select>  
 </form>  
 <div id="other">  
 Trigger the handler  
 </div>  
 $( ".target" ).change(function() {  
 alert( "Handler for .change() called." );  
 });  
 $( "#other" ).click(function() {  
 $( ".target" ).change();  
 });  
 <html lang="en">  
 <head>  
 <meta charset="utf-8">  
 <title>change demo</title>  
 <style>  
 div {  
 color: red;  
 }  
 </style>  
 <script src="//code.jquery.com/jquery-1.10.2.js"></script>  
 </head>  
 <body>  
 <select name="sweets" multiple="multiple">  
 <option>Chocolate</option>  
 <option selected="selected">Candy</option>  
 <option>Taffy</option>  
 <option selected="selected">Caramel</option>  
 <option>Fudge</option>  
 <option>Cookie</option>  
 </select>  
 <div></div>  
 <script>  
 $( "select" )  
 .change(function () {  
 var str = "";  
 $( "select option:selected" ).each(function() {  
 str += $( this ).text() + " ";  
 });  
 $( "div" ).text( str );  
 })  
 .change();  
 </script>  
 </body>  
 </html>  

 if you want more related search please click here  
 please help to other  
 http://scriptquery.blogspot.in/  


12:11 AM Share:

0 comments:

Get updates in your email box
Complete the form below, and we'll send you the best coupons.

Deliver via FeedBurner
Proudly Powered by Blogger.
back to top