Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7667831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:12:16+00:00 2026-05-31T15:12:16+00:00

I have a jQuery function: $(function(){ function InitDialog(c,b){ /* some code */ } $(‘a[name=dialog]’).click(function(e)

  • 0

I have a jQuery function:

$(function(){ 
function InitDialog(c,b){
    /* some code */     
}

$('a[name=dialog]').click(function(e)                                                 {         
            InitDialog(caption, bodyText);        
    fadeInCommon(e,this);
});
});

And also I have a link defined in html code like below:

<ul>
<li><a href="#dialog" name="someInformation" }">something</a></li>
</ul>

My question is how can I pass the parameters (caption, bodyText) to Init() function via link?
I’ve heard about some method like below:

<li><a href="#dialog" name="someInformation" onClick="return {height: 100, width:200};"}">something</a></li> 

But I don’t understand how can I get and parse it?
Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T15:12:18+00:00Added an answer on May 31, 2026 at 3:12 pm

    So first, I think you want to say $('a[href="#dialog"]') to get the a tags, then in the click function, $(this).attr("name") will give you the some information, which you could store a json string…

    <a href="#dialog" name="{caption:'XXXX', bodyText:'XXXX'}">My Text</a>
    
    $('a[href="#dialog"]').click(function() {
         var data = JSON.parse($(this).attr("name"));
         InitDialog(data.caption, data.bodyText);
    });
    

    But, I don’t think that’s the right way of going about what you’re trying to do, would you be better to create the dialog in a div lower down the page, hide it, and only show it when you click the link? Because the term ‘bodyText’ implies it’s going to be big…

    Or just:

     <a href="javascript:InitDialog('Caption', 'BodyText'); fadeInCommon(e,this);">My Link</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following jquery function for some links $(.clickable).click(function(event){ // load dialog content...
I have this jQuery function : $('a[name=pmRead]').click(function(e) { e.preventDefault(); $(this).parents(.pmMain).find(.pmMain5).toggle(); $.ajax({ type: 'POST', cache:
I have this jQuery simple code: <script type=text/javascript> <!-- jQuery(function(){ jQuery('#old_thumb').click(function(){ $(this).val($(this).attr('title')); $('#sf').val('2'); $('#add_new_event').submit();
I have the following jquery code: jQuery(function(){ jQuery(select#rooms).change(function(){ var options = ''; jQuery.getJSON(/admin/selection.php,{id: jQuery(this).val(),
Say I have a jquery function within JavaScript and I have this code so
I have some jQuery code. I have called an Ajax function file, file.php, that
I have this JQuery function: function addSomeHTML() { $(#mysection).html(<div id='myid'>some content here</div>); } I
I have this jquery code: <script src=../js/jquery-1.6.1.min.js type=text/javascript></script> <script src=../js/jquery.validate.js type=text/javascript></script> <script type=text/javascript> jQuery(function(){
i have this jQuery function: $(#text).load(test3.php?id=+ Math.random()); And this code is in page: user.php
I have a jQuery UI Dialog working great on my ASP.NET page: jQuery(function() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.