I hope the title means something, I don't really know how to explain what I am trying to do in a few words.
I think better with an example.

I have a click event to display an enquiry form on a contact page:

$("#enquiry-form").hide();
	$('.enquiry-form').click(function() {
		$(this).hide();
		$('#enquiry-form').fadeIn( 'slow', function() {
		      $('#senderName').focus();
		    } )
	});

All fine.

Now if a user clicks on the following link

<a href="contact-united-diesel.php?part_number=<?php echo $row['parts_number']; ?>"><input type="button" class="rounded-buttons" name="enquire" value="Enquire" /></a>

I want them to be taken to the contact page and display the Enquiry Form.

I want to know if it is possible (and if so, how) to trigger the click event that displays the enquiry form on the contact page if the page is accessed via the above link?

document.referrer=="that location string"
yourLinkElement.click();

Sorry I obviously haven't made myself clear - it isn't the referring page that I need to check but if the url contains the additional parameter for the part number.

If anyone is interested, this is how I have resolved this issue (using the example url above):

if($('window.location.search.substring(1):contains("part_number")')) {
	    $('.enquiry-form').trigger('click');
	}

So how do you translate this to English than?cite: "I want to know if it is possible (and if so, how) to trigger the click event that displays the enquiry form on the contact page if the page is accessed via the above link?"
Anyways, thanks for sharing with the community.
In javascript at least, you don't need to call for triggers, you simply do element.click(); and its clicked, which is so much cleaner.

and or for a completion sake as simple as:

location.search.match("part_number")?
oElement.click() : 0;

Ain't that twice as clean and far more simple?

But once again [just for the sake of curiosity ]
Trigger click event if page loaded from a certain referring URL
how do you translate this question into what you are saying now without some powerful trans-mutational alchemy?

Sorry, my bad as not what I meant to say. I should have said

Trigger click event if referring url contains certain parameters

Anyway I am happy with what I have and doesn't seem too long winded and keeps all my javascript / jquery together nicely but thank you for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.