[jQuery] Re: How to retrieve the selected cells
Thanks Kanpan, with your code I know where to make the ajax call. Combining with MorningZ's solution and your suggestion I am very certain that I will be able to get my task done! Thank you guys for your help! On Jan 4, 11:55 pm, Kanpan wrote: > What you know is that you're assigning classes to the selected cells. > Your best bet is to detect an onclick event on your button and then > loop through the td elements with the class "sel" and get each of > their value. Then take those values and submit them via ajax to your > php script. > > Something like... > > $("#MyBtn").click(function() { > var values; > $(".sel").each(function() { > values += $(this).html()+","; > }): > $.ajax({ > ... > }); > > }); > > On Jan 4, 10:11 pm, MT wrote: > > > Hi all, > > > I am new to jQuery and I would like to process a matrix operation > > using PHP. > > The front-end code is done bellow, its a 3x3 table. the user could > > select/deselect individual cells of the table and click the button > > that calls a PHP script that will run some function. > > > 1) How do I know if a cell is selected? Is there is is_selected( ) > > function in jQuery? > > 2) Would it be possible to send a 3x3 array to my PHP script? > > > Please provide me with any info on this. Thanks! > > > MT > > > My current test code. > > --- > > - > > Test > > > src='<a rel="nofollow" href="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js">http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js</a>'></ > > script> > > > <script type="text/javascript"> > > $(document).ready(function() { > > $("td").toggle( > > function () { $(this).addClass("sel"); }, > > function () { $(this).removeClass("sel"); } > > ); > > > }); > > > > > > > .sel { background-color:red; } > > > > > > > > > > 123 > > 456 > > 789 > > > > > Click here to process the selection with a php script > > > > > --- > > -
[jQuery] Re: How to retrieve the selected cells
Thanks MorningZ for that wonderful demo. I think you have nailed my question here! Thank you so much! On Jan 5, 12:14 am, MorningZ wrote: > > 1) How do I know if a cell is selected? Is there is is_selected( ) > > function in jQuery? > > There's the ":selected" selector, but it's for valid form fields, not > table cells... > > in your case, $("table td.sel") would give you all selected table > cells > > I have no idea what your PHP looks like, but one way to gather the > data could be: > > http://jsbin.com/areti/edit > > but that all depends on what you are looking for (just selected cell > "values"? do you need position on the grid? something else?) > > On Jan 4, 10:11 pm, MT wrote: > > > Hi all, > > > I am new to jQuery and I would like to process a matrix operation > > using PHP. > > The front-end code is done bellow, its a 3x3 table. the user could > > select/deselect individual cells of the table and click the button > > that calls a PHP script that will run some function. > > > 1) How do I know if a cell is selected? Is there is is_selected( ) > > function in jQuery? > > 2) Would it be possible to send a 3x3 array to my PHP script? > > > Please provide me with any info on this. Thanks! > > > MT > > > My current test code. > > > > Test > > > src='<a rel="nofollow" href="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js">http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js</a>'></ > > script> > > > <script type="text/javascript"> > > $(document).ready(function() { > > $("td").toggle( > > function () { $(this).addClass("sel"); }, > > function () { $(this).removeClass("sel"); } > > ); > > > }); > > > > > > > .sel { background-color:red; } > > > > > > > > > > 123 > > 456 > > 789 > > > > > Click here to process the selection with a php script > > > > >
[jQuery] How to retrieve the selected cells
Hi all, I am new to jQuery and I would like to process a matrix operation using PHP. The front-end code is done bellow, its a 3x3 table. the user could select/deselect individual cells of the table and click the button that calls a PHP script that will run some function. 1) How do I know if a cell is selected? Is there is is_selected( ) function in jQuery? 2) Would it be possible to send a 3x3 array to my PHP script? Please provide me with any info on this. Thanks! MT My current test code. Test $(document).ready(function() { $("td").toggle( function () { $(this).addClass("sel"); }, function () { $(this).removeClass("sel"); } ); }); .sel { background-color:red; } 123 456 789 Click here to process the selection with a php script
[jQuery] jQuery - Windows 7 parental control interface
Hi all, Hope you all are having a great holidays and I wish you all a very happy new year! I am looking for a plugin/widget in jQuery to get a "Windows 7's Parental control - time range picker" like interface for one of my web project. where I want to select few block of a 2D tabe and retrieve the selection matrix. Please direct me at the right direction on this one. I am not sure if there is a plug-in already exist to do this job. Please let me know. Thanks for your help! MT