This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| To get the value of the selected radioName item of a form called 'myForm': | |
| $('input[name=radioName]:checked', '#myForm').val() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <a onclick="Data(this)">This Month</a> | |
| function Data(el) | |
| { | |
| $(el).parent().addClass('active') ; | |
| //el can used for this | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| how to select a parent element in jquery with a particular class | |
| Use .closest() with a selector: | |
| var selected = $('#id').closest('.className'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| header("Access-Control-Allow-Origin: *"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The accept attribute is incredibly useful. It is a hint to browsers to only show files that are allowed for the current input. While it can typically be overridden by users, it helps narrow down the results for users by default, so they can get exactly what they're looking for without having to sift through a hundred different file types. | |
| Usage | |
| Note: These examples were written based on the current specification and may not actually work in all (or any) browsers. The specification may also change in the future, which could break these examples. | |
| h1 { font-size: 1em; margin:1em 0; } | |
| h1 ~ h1 { border-top: 1px solid #ccc; padding-top: 1em; } | |
| <h1>Match all image files (image/*)</h1> | |
| <p><label>image/* <input type="file" accept="image/*"></label></p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <select> | |
| <option data-id="1">one</option> | |
| <option data-id="2">two</option> | |
| <option data-id="3">three</option> | |
| </select> | |
| You need to find the selected option: | |
| $(this).find(':selected').data('id') | |
| or |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $( ".target" ).change(function() { | |
| alert( "Handler for .change() called." ); | |
| }); | |
| //The change event is sent to an element when its value changes. This event is limited to <input> elements, <textarea> boxes and <select> elements. |
NewerOlder