0
我有下面的jQuery更改div的可見性取決於被點擊的按鈕,我現在想要做的是從按鈕的數據標記被用作一個變量,我可以使用PHP運行,我將如何去做這件事?jquery數據標記和GET
感謝
$(window).load(function(){
jQuery(function ($) {
$("button").click(function() {
var Swapper = $(this).attr("href")
/* var model = $(this).data("model_id") How can I use the model variable?*/
var $swap = $(Swapper).stop(true, true),
visible = $swap.is(':visible');
$swap.slideToggle("fast");
if (visible) {
$(".ContentSwap.defaultSwap").show();
} else {
$(".ContentSwap:visible").not(Swapper).hide();
}
});
});
PHP生成按鈕
echo "<button type='button' id=equipment_swap' class='Add' data='model_id=".$equipment_model_id."' href='#editEquipmentSwap'>Edit</button>";