开发者

Read selected line from a table using Javascript/jquery

开发者 https://www.devze.com 2023-02-06 21:33 出处:网络
I have a table which displays datas from a table. I want to display more details based on the line selected. How can I now which line is selected and how can I get the value of that filed?

I have a table which displays datas from a table. I want to display more details based on the line selected. How can I now which line is selected and how can I get the value of that filed?

<table>
    <%
           loop at lt_staff_list assigning <ls_abs_line>.
    %>
    <tr>
        <td width="10%"><a href="detail" data-transition="slide">开发者_如何学Go
             <%= <ls_abs_line>-objnr_f %></a>
        </td>
    </tr>
    <% endloop %>
<table>

Here if there are 5 records in the table, it will display 5 rows. I want to get the value of <ls_abs_line>-objnr_f selected line in a variable which I can use on the next screen.


you could use this:

<a href="detail" data-transition="slide"><%= <ls_abs_line>-objnr_f %></a>

<script type="text/javascript">
$(function(){
    $("a").click(function(){
        var txt=$(this).text();
         //txt:- THIS IS THE TEXT YOU OUTPUTTING WITH
         //<%= <ls_abs_line>-objnr_f %>
    });
});
</script>


I would take a look at jquery UI. They have a selectable class that you can apply to an element and then, when selected it throws events:

http://jqueryui.com/demos/selectable/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号