locked
need to retrieve basevalue RRS feed

  • Question

  • User932259438 posted

    hi,

    how can i retrieved basevalue if I have source code like this:

    <a title="Nykobing FC" class="lnkodds1" id="ctl00_ContentPlaceHolder1_RptOddsType_ctl00_rptOdds3_ctl00_lnkOdds1" style="display:inline-block;width:100%;" href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$RptOddsType$ctl00$rptOdds3$ctl00$lnkOdds1','')" pick="2">
                                                                                                            <p style="float:left;"><span id="ctl00_ContentPlaceHolder1_RptOddsType_ctl00_rptOdds3_ctl00_Label8">Nykobing FC </span></p>
                                                                                                            <p style="float:right"><span id="ctl00_ContentPlaceHolder1_RptOddsType_ctl00_rptOdds3_ctl00_Label1" basevalue="2.40" formetprice="true">2.40</span></p>
                                                                                                                </a>

    my code:

        $('.lnkodds1').on("click", function (event) {
    
            // (".lnkodds1");
    
            //Event Name // alert($('#ContentPlaceHolder1_lblEventName').html())
            //Match Date alert($('#ContentPlaceHolder1_lblMatchDate').html())
    
            //Pick alert($(this).attr("title"));
    
            alert($("#ctl00_ContentPlaceHolder1_RptOddsType_ctl00_rptOdds3_ctl00_Label8").attr("basevalue").html());

    I need retrieve label8 attribute basevalue but I think i Need "$this" because I have also ctl00_rptOdds3_ctl01_Label8

    Pls help.

    Monday, September 5, 2016 10:57 AM

All replies

  • User932259438 posted

    Still I need your help.

    I was trying:

    alert($('.bet').html());

    <span class="bet" id="ctl00_ContentPlaceHolder1_RptOddsType_ctl00_rptOdds3_ctl00_Label8">Nykobing FC </span>
    <span class="bet" id="ctl00_ContentPlaceHolder1_RptOddsType_ctl01_rptOdds3_ctl00_Label8">1 or Draw </span>
    
    
    Always I got: Nykobing FC 
    
    But I want to get also 1 or Draw if clicked, pls check above code



    Monday, September 5, 2016 1:25 PM
  • User-1142886626 posted

    Hi progy85,

    Always I got: Nykobing FC But I want to get also 1 or Draw if clicked, pls check above code

    Make sure you have jQuery file referenced correctly, you could take a look with a web developer tool (press F12 in IE8 or above for example). Then check if the jQuery file’s indeed downloaded or not.

    Following link is about how to use it.

    https://msdn.microsoft.com/en-us/library/gg589512(v=vs.85).aspx

    Code below is for your reference.

    <script  src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js">
    </script>
        <script type="text/javascript">
            $(function () {
                $(".bet2").hide();
                $(".bet1").click(function () {
                    $(".bet1").hide();
                    $(".bet2").show();
                })
            })
        </script>
    <body>
        <div>  
    <span class="bet1" id="ctl00_ContentPlaceHolder1_RptOddsType_ctl00_rptOdds3_ctl00_Label8">Nykobing FC </span>
    <span class="bet2" id="ctl00_ContentPlaceHolder1_RptOddsType_ctl01_rptOdds3_ctl00_Label8">1 or Draw </span>
        </div>
    </body>
    

    Best Regards,

    Ailleen

    Tuesday, September 6, 2016 3:52 AM