How to replace character inside double quote in javascript?

Pawan

I want to replace parameter of the function in javascript.Eg:

I have one function DeleteProduct("2") and in some condition i want to replace the parameter of DeleteProduct() function. Like that:

DeleteProduct("1")

I have tried this(means how i am replacing the parameter value):

 $('#Addr1Div').html($('#Addr2Div').html().replace(/"2"/g, '"1"'));

But its not working.

I am calling function like that:

 <a href='javascript:$.DeleteProduct(\"2\");'>Delete</a>
vladkras

replace it exactly in href attribute

var newHref = $('a').attr('href').replace(/"2"/g, '"1"');
// or whatever you use to access <a>
$('a').attr('href', newHref);

DEMO

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How to replace "single quote" to "double single quote" in XSLT

분류에서Dev

Replace a double backslash followed by quote (\\') using sed?

분류에서Dev

Replace particular character but not if it is inside ()

분류에서Dev

Ignoring a Rogue quote inside Double quotes

분류에서Dev

catching __('<string>') inside simple and double quote

분류에서Dev

Regex to replace character inside an image tag

분류에서Dev

How to find and replace the character "*" in Excel

분류에서Dev

Bash script double quote

분류에서Dev

Javascript: Replace everything inside an Array with a new value

분류에서Dev

How to find and replace numeric rows in a character vector?

분류에서Dev

How to replace character in capture group with sed

분류에서Dev

preg_replace issue. Character class inside other character class

분류에서Dev

How should i replace double space(continuous space) by double characters?

분류에서Dev

How can I solve "unmatched double quote" error using dbus-monitor in combination with xargs?

분류에서Dev

Storing string containing double quote in Liferay preferences

분류에서Dev

How to use php inside of javascript?

분류에서Dev

How to replace set of repeating String pattern with specific character?

분류에서Dev

How to replace the first blank space, within a string, with a different character?

분류에서Dev

How to delete/replace everything in column after certain character fetched with awk?

분류에서Dev

how to replace specific character(s) in string by number(s)

분류에서Dev

How do I replace double quotes with its escape?

분류에서Dev

How to add a newline every three character in javascript

분류에서Dev

Replace special character in htaccess

분류에서Dev

Replace special character in htaccess

분류에서Dev

How to replace all special characters using javascript

분류에서Dev

Adding double quotes around a string adds the closing quote on a new line

분류에서Dev

new line, double quote giving error in json data

분류에서Dev

Escaping double quotes around argument of onClick in single quote string

분류에서Dev

Obj-c Seperate a string by double quote using regular expression

Related 관련 기사

  1. 1

    How to replace "single quote" to "double single quote" in XSLT

  2. 2

    Replace a double backslash followed by quote (\\') using sed?

  3. 3

    Replace particular character but not if it is inside ()

  4. 4

    Ignoring a Rogue quote inside Double quotes

  5. 5

    catching __('<string>') inside simple and double quote

  6. 6

    Regex to replace character inside an image tag

  7. 7

    How to find and replace the character "*" in Excel

  8. 8

    Bash script double quote

  9. 9

    Javascript: Replace everything inside an Array with a new value

  10. 10

    How to find and replace numeric rows in a character vector?

  11. 11

    How to replace character in capture group with sed

  12. 12

    preg_replace issue. Character class inside other character class

  13. 13

    How should i replace double space(continuous space) by double characters?

  14. 14

    How can I solve "unmatched double quote" error using dbus-monitor in combination with xargs?

  15. 15

    Storing string containing double quote in Liferay preferences

  16. 16

    How to use php inside of javascript?

  17. 17

    How to replace set of repeating String pattern with specific character?

  18. 18

    How to replace the first blank space, within a string, with a different character?

  19. 19

    How to delete/replace everything in column after certain character fetched with awk?

  20. 20

    how to replace specific character(s) in string by number(s)

  21. 21

    How do I replace double quotes with its escape?

  22. 22

    How to add a newline every three character in javascript

  23. 23

    Replace special character in htaccess

  24. 24

    Replace special character in htaccess

  25. 25

    How to replace all special characters using javascript

  26. 26

    Adding double quotes around a string adds the closing quote on a new line

  27. 27

    new line, double quote giving error in json data

  28. 28

    Escaping double quotes around argument of onClick in single quote string

  29. 29

    Obj-c Seperate a string by double quote using regular expression

뜨겁다태그

보관