href

jQuery attr href, why isn't it working?

我只是一个虾纸丫 提交于 2019-12-22 08:42:12
问题 I thought the following line of code should work fine: $(".1").attr('href', '#Home'); Right? But why isn't it working when I integrate it with another jQuery script? $(window).bind("load", function() { $('.1').click(function() { $('.1').removeClass('tab1'); $('.2').removeClass('active2'); $('.3').removeClass('active3'); $('.4').removeClass('active4'); $('.1').addClass('active1'); $('.2').addClass('tab2'); $('.3').addClass('tab3'); $('.4').addClass('tab4'); $('#PortfolioMainContainer:visible')

jQuery replace href value but only partially? [duplicate]

旧巷老猫 提交于 2019-12-22 05:59:47
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Change href parameter using jQuery I have a page with several links like this: <a href="playcats.php?cat='.$catname.'&sl=10" class="golink"> So after PHP page loads it will look like: <a href="playcats.php?cat=blue&sl=10" class="golink"> <a href="playcats.php?cat=red&sl=10" class="golink"> <a href="playcats.php?cat=yellow&sl=10" class="golink"> ... I want partially change the href for the sl value of all links

jQuery replace href value but only partially? [duplicate]

寵の児 提交于 2019-12-22 05:59:07
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Change href parameter using jQuery I have a page with several links like this: <a href="playcats.php?cat='.$catname.'&sl=10" class="golink"> So after PHP page loads it will look like: <a href="playcats.php?cat=blue&sl=10" class="golink"> <a href="playcats.php?cat=red&sl=10" class="golink"> <a href="playcats.php?cat=yellow&sl=10" class="golink"> ... I want partially change the href for the sl value of all links

Linking to external URL with different domain from within an angularJS partial

末鹿安然 提交于 2019-12-22 04:47:15
问题 All I am trying to do is include an anchor tag inside the html of a partial that links to an external site. Were this standard html, the code would simply be: <a href="http://www.google.com" target="_blank">google</a> As simple as this is, I cannot seem to find a working solution for getting past angular intercepting the route (or perhaps replacing my anchor with the https://docs.angularjs.org/api/ng/directive/a directive unintentionally?). I have scoured SO and the rest of the web and seen a

window.location.href send multiple parameters asp.net mvc

喜夏-厌秋 提交于 2019-12-21 20:36:51
问题 I try to post multiple data to actionresult. function OnButtonClick() { var data = { TextBox1: TextBox1.GetValue(), TextBox2: TextBox2.GetValue() }; var PostData1 = data.TextBox1; var PostData2 = data.TextBox2; window.location.href ="Home/MyActionResult?Page=data&Post=" + PostData1 + PostData2 ; } ActionResult: public ActionResult MyActionResult(string PostData1, string PostData2) { return view(); } I can send PostData1 value however i can not send PostData2 value to actionresult.So how can i

How To Add An “a href” Link To A “div”?

﹥>﹥吖頭↗ 提交于 2019-12-21 07:13:50
问题 I need to know how to add an a href link to a div? Do you put the a href tag arounf the entire "buttonOne" div? Or should it be around or inside the "linkedinB" div? Here's my HTML: <div id="buttonOne"> <div id="linkedinB"> <img src="img/linkedinB.png" width="40" height="40"> </div> </div> 回答1: Can't you surround it with an a tag? <a href="#"><div id="buttonOne"> <div id="linkedinB"> <img src="img/linkedinB.png" width="40" height="40"> </div> </div></a> 回答2: In this case, it doesn't matter as

How to hide an anchor tag by href #id using css

邮差的信 提交于 2019-12-21 04:18:33
问题 I have different anchor tags with href=#ids and I need to hide them using a general css rule for all of them, Content xxxxxxxxx <a href="#tab1">Table 1</a>.Content xxxxxxxxxxxx <a href="#tab2">Table 2</a> I was trying to use something like this: #wrap a='#tab1'{ display:none; } Any idea how to do it? 回答1: Try using attribute selectors: a[href='#tab1']{ display: none } Or even simply [href='#tab1']{ display: none } http://www.w3.org/TR/CSS2/selector.html 回答2: Why not just create a CSS class

How to get the base path in jQuery?

送分小仙女□ 提交于 2019-12-20 10:17:58
问题 window.location works fine, but returns me the whole, absolute path, like http://domain.xyz/punch/lines . But I only need http://domain.xyz/ . How can I extract only that first part? And how can I make that dynamic, I mean to be always the same even when the subdirectory path gets longer? 回答1: You can get the protocol and the host separately, and then join them to get what you need window.location.protocol + "//" + window.location.host + "/" As a sidenote, window.location.pathname would

How to match URL with href in jQuery?

此生再无相见时 提交于 2019-12-20 05:39:10
问题 Using a list for navigation, I am looking for a clean way to apply the 'selected' class to a list item if the page URL (minus anything after the path) matches the href of the list item (minus anything after the path). Example: <li><a href="/p/clothing/dresses/N-10635?ab=leftNav:dresses">dresses</a></li> Apply class "selected" to the list item when the page URL includes the /p/clothing/dresses/N-10635 part of the href. So far, I achieved partial results using: $('.leftNav li a').each(function(

How can I open a new tab or window when a link is clicked?

戏子无情 提交于 2019-12-20 01:04:23
问题 I have same ancors/hyperlink in my html file. These point to a new website outside my site. So I want that when the user clicks the link it should open a new tab or window. My website page should not be closed. How can it be done? 回答1: <a href="newpage.htm" target="_blank">Click me to open in a new tab/window</a> Load the linked document into a new blank window. This window is not named. If there is no existing window or frame with the same name as specified in the target, a new window is