我要创建链接,例如:
google.com/#payBtn
#payBtn
元素是我的电话号码,应显示google.com/56000
例如:
$("#payBtn").click(function() {
$("#count").html($("#member").val()); var price =
$("#member").val(); price = price * 7; $("#payBtn").html(price);
});
这是回声,但是我想通过链接回声!
我该怎么办?`
答案 0 :(得分:0)
您可以将串联符号+
与数字一起使用,例如:
$("#payBtn").click(function() {
location.href = 'http://payping.ir/' + $("#member").val();
});
.GetBtn {
border: none;
background-color: #6dc55d;
border-bottom: 4px solid #4CAF50;
padding: 7px;
font-size: 17px;
border-radius: 2px;
width: 100%;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
color: white;
}
.GetBtn:hover {
background-color: #43A047;
border-bottom: 4px solid #388E3C;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input id="member" value="50">
<button class="getBtn" id="payBtn">Pay And Give</button>