Thứ Ba, 29 tháng 7, 2014

jquery

5. Nút click cho link, có thể dừng tại trang luôn
    <a href="syohinKensaku6_search.aspx?r=y" style="text-decoration:none;  color: Black;" id="A1">
    <script type="text/javascript">
        var el = document.getElementById('linkbacksearch');
        el.onclick = showFoo;


        function showFoo() {
          alert('I am foo!');
          return false;
        }   
    </script>

4. function CheckNum() {
//    if (((event.keyCode < 48) || (event.keyCode > 57)) && (event.keyCode != 45) && (event.keyCode != 46)) {
    if (((event.keyCode < 48) || (event.keyCode > 57)) ) {
        window.event.returnValue = false;
    }
}

3.



How do I get the text value of a selected option?

Select elements typically have two values that you want to access. First there's the value to be sent to the server, which is easy:
1
2
$( "#myselect" ).val();
// => 1
The second is the text value of the select. For example, using the following select box:
1
2
3
4
5
6
7
<select id="myselect">
<option value="1">Mr</option>
<option value="2">Mrs</option>
<option value="3">Ms</option>
<option value="4">Dr</option>
<option value="5">Prof</option>
</select>
If you wanted to get the string "Mr" if the first option was selected (instead of just "1") you would do that in the following way:
1
2
$( "#myselect option:selected" ).text();
// => "Mr"


2.

div class="bookingTitle">' +: chỗ item of List
A.
$('.checkboxtravel').click(function () {
        $(".checkboxtravel").each(function () {
            $(".checkboxtravel").attr('checked', false);
        });
this.checked = true;
    });


B.
    $('#idStartFU').click(function() {
var FU = $('input:radio[name=idStartDate]:checked').val();
        $('#idStartFU').prop('checked', true);
        alert(FU);
    });
///     1: Get the value of a property for the first element in the set of matched elements.
///     &#10;    1.1 - prop(propertyName)
///     &#10;2: Set one or more properties for the set of matched elements.
///     &#10;    2.1 - prop(propertyName, value)
///     &#10;    2.2 - prop(map)
///     &#10;    2.3 - prop(propertyName, function(index, oldPropertyValue))
C.
            $("#bbit_cal_event_" + id).hide();
            $("#DeleteModal").modal('hide'); // dismiss the dialog 

//List checkbox of color
    $('#label-list').click(function() {
        $('.checkbox-grp .check').each(function() {
if ($(this).hasClass('icon-ok'))
                alert($(this).attr('value'));
        });
    });
D.
1. var TInDaycr = $('input:radio[name=idStartDate]:checked').val();
2. function getLabelColorCode() {
var LabelColorCode = $('.icon-ok').attr('value');
return LabelColorCode;
    };

3.function getColorId() {
var colorId = $('.icon-ok  input[type="text"]').attr('value');
return colorId;
    };

4. var StartDateTime = new Date($("#start").val().toString());
5.                    if ($("#cal-list-cc").is(":visible")) {
                        holidayIDEdit = document.getElementById('bbit-cs-idEdit').value;
                    }
6. $('#caltoolbar #faddbtn').show();

7. function checkUncheckDiv(target) {
var parent = $(target).parent();
if (!$(target).hasClass("icon-ok")) {
        parent.find('.check').removeClass("icon-ok");
        parent.find('.checkbox input').prop('checked', "");
        $(target).addClass("icon-ok");
    }
else {
        parent.find('.checkbox input').prop('checked', target.checked);
    }
}


8. var viewButtonId = $('#calendarViewButton').find('.fcurrent').attr('id');
9. $('body').append('<div id="calendarMask" onclick="$(\'#bubbleClose1\').click();"></div>');

10.
var closebtn = $("#bubbleClose1").click(function() {
                    $("#bbit-cal-buddle").css("visibility", "hidden");
//$("#bbit-cal-buddle").css("display", "none");
                    $('#calendarMask').remove();
                    realsedragevent();
                });
11. array
var temparr = [];
temparr.push('
temparr.push('
var tempquickAddHanler = temparr.join("");
12.                 ul li
//get list id table
function getHolidayIdList() {
var data = "";

            $('#quickCalendarLabel #ul_list_menuleft > li[isShow=1]').each(function(index) {
var id = $(this).attr('HolidayId');
                data += id + ",";
            });
if (data.length > 0) {
                data = data.substring(0, data.length - 1);
            }
return data;
        }
}

$("#ul_list_menuleft").append("<li labelId= '" + labelIDcr + "'  HolidayId= '' isShow='1'  ><div class='colorField' style='background:#" + labelColorCodecr + "' id='color'></div><div class='labelName' style=''>" + labelNamecr + "</div></li>");

13.
$(document).ready(function() {
var $speech = $('div.speech');
var defaultSize = $speech.css('fontSize');
    $('#switcher button').click(function() {
var num = parseFloat($speech.css('fontSize'), 10);
switch (this.id) {
case'switcher-large':
                num *= 1.4;
break;
case'switcher-small':
                num /= 1.4;
break;
default:
                num = parseFloat(defaultSize, 10);
        }
        $speech.css('fontSize', num + 'px');
    });
});
14.
if (!this.$element.is(':visible'))
:disabled

15.
$("button").click(function() {
    $("#w3s").attr({
"href": "http://www.w3schools.com/jquery",
"title": "W3Schools jQuery Tutorial"
    });
});
16.
$("p").remove(".italic");

Không có nhận xét nào:

Đăng nhận xét