Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <tr><img id="i will put value for db processing"src="urlofimage"</tr>
- $.fn.hasBorder = function() {
- if ((this.outerWidth() - this.innerWidth() > 0) || (this.outerHeight() - this.innerHeight() > 0)){
- return true;
- }
- else{
- return false;
- }
- };
- $(document).ready(function() {
- var selectedImgsArr = [];
- $("img").click(function() {
- if($(this).hasBorder()) {
- $(this).css("border", "");
- //you can remove the id from array if you need to
- }
- else {
- $(this).css("border", "1 px solid red");
- selectedImgsArr.push($(this).attr("id")); //something like this
- }
- });
- });
- <html>
- ...
- <td><img class='galImages' src='urlofimage' /></td>
- ...
- </html>
- <script>
- $document.ready(function() {
- $('img.galImages').click(function() {
- if($(this).hasClass('selected') {
- $(this).removeClass('selected');
- }
- else {
- $(this).addClass('selected');
- }
- });
- });
- </script>
- <style>
- .selected {
- 1px solid #f00;
- }
- </style>
- <tr><img class="clickable" id="i will put value for db processing" src="urlofimage" /></tr>
- <script>
- $(document).ready(function() {
- var clickedarray = new Array();
- $('.clickable').click(function() {
- //add border
- $(this).css({border: '1px solid #000'});
- //store in array
- clickedarray.push($(this).attr('id'));
- });
- });
- </script>
- $(document).ready(function() {
- var selectedImgsArr = new Array();
- $("img").click(function() {
- if($(this).hasClass("selected-image"))
- $(this).removeClass("selected-image");
- else
- $(this).addClass("selected-image");
- });
- $("form").submit(function(){
- selectedImgsArr.push($(".selected-image").attr("src"));
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement